Class SilentErrorHandler

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

public class SilentErrorHandler extends Object implements ErrorHandler
An ErrorHandler implementation that suppresses all processing errors and allows message tracking to continue.

This handler is ideal for non-critical consumers where message loss or failure should not disrupt the application, such as:

  • Metrics collection
  • Auditing or logging projections
  • Replays for observability/debugging

Logging Behavior:

  • If maxLevel is specified, all errors are logged at that level (e.g., WARN, DEBUG).
  • If maxLevel is null, errors are completely silent—nothing is logged.
  • All logs include the error context and exception stack trace (if any).

Control Flow:

  • The error is returned as-is, meaning it may be published as a Result message but does not halt processing.
  • The original retryFunction is not invoked.
  • No exceptions are thrown—tracking always continues.

Usage: Can be registered via Consumer.errorHandler() or programmatically via ConsumerConfiguration.


 @Consumer(name = "audit", errorHandler = SilentErrorHandler.class)
 public class AuditProjection {
     @HandleEvent
     void on(UserLoggedIn event) {
         // Failure to write to audit log won't affect tracking
     }
 }
 
See Also:
  • Constructor Details

    • SilentErrorHandler

      public SilentErrorHandler()
      Constructs a SilentErrorHandler that does not log any errors.
  • Method Details

    • handleError

      public Object handleError(Throwable error, String errorMessage, Callable<?> retryFunction)
      Handles the given error by optionally logging it and then returning it without retry or propagation.
      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)