Class LoggingErrorHandler

java.lang.Object
io.fluxcapacitor.javaclient.tracking.LoggingErrorHandler
All Implemented Interfaces:
ErrorHandler

public class LoggingErrorHandler extends Object implements ErrorHandler
The default ErrorHandler implementation used by Flux Capacitor consumers.

This handler logs errors that occur during message tracking and processing, then allows tracking to continue. It is intended for general-purpose use where robustness is more important than fail-fast behavior, but silent failure is undesirable.

Logging Behavior:

  • Technical exceptions (i.e., not FunctionalException) are always logged at ERROR level.
  • FunctionalExceptions are logged at WARN level if logFunctionalErrors is true.
  • The error message and full exception are included in logs to aid observability.

Control Flow:

  • Tracking always continues; no exception is thrown.
  • The original error is returned, and may be published as a Result message.
  • The retryFunction is not executed in this implementation.

Usage: This handler is used by default if no custom errorHandler is specified in the Consumer annotation or ConsumerConfiguration.


 @Consumer(name = "default")
 public class MyHandler {
     @HandleEvent
     void on(UserRegistered event) {
         // Recoverable errors will be logged and processing continues
     }
 }
 
See Also:
  • Constructor Details

    • LoggingErrorHandler

      public LoggingErrorHandler()
      Constructs a LoggingErrorHandler that logs both technical and functional errors.
  • Method Details

    • handleError

      public Object handleError(Throwable error, String errorMessage, Callable<?> retryFunction)
      Logs the given error and allows tracking to continue.
      Specified by:
      handleError in interface ErrorHandler
      Parameters:
      error - the Throwable encountered during message processing
      errorMessage - context about the failure
      retryFunction - the operation that was attempted (ignored in this implementation)
      Returns:
      the original error object (may be published as a Result message)