Class SilentErrorHandler
java.lang.Object
io.fluxcapacitor.javaclient.tracking.SilentErrorHandler
- All Implemented Interfaces:
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
isnull
, 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 Summary
ConstructorsConstructorDescriptionConstructs aSilentErrorHandler
that does not log any errors. -
Method Summary
Modifier and TypeMethodDescriptionhandleError
(Throwable error, String errorMessage, Callable<?> retryFunction) Handles the given error by optionally logging it and then returning it without retry or propagation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.javaclient.tracking.ErrorHandler
handleError
-
Constructor Details
-
SilentErrorHandler
public SilentErrorHandler()Constructs aSilentErrorHandler
that does not log any errors.
-
-
Method Details
-
handleError
Handles the given error by optionally logging it and then returning it without retry or propagation.- Specified by:
handleError
in interfaceErrorHandler
- Parameters:
error
- theThrowable
encountered during message processingerrorMessage
- context about the failureretryFunction
- the operation that was attempted (ignored in this implementation)- Returns:
- the original error object (may be published as a
Result
message)
-