Class SilentErrorHandler
java.lang.Object
io.fluxzero.sdk.tracking.SilentErrorHandler
- All Implemented Interfaces:
ErrorHandler
An
ErrorHandler implementation that suppresses all processing errors and allows message tracking to
continue.
Start with LoggingErrorHandler so failures remain visible. Use this handler only for deliberately
best-effort consumers with separate observability, where skipping a failed effect is acceptable, such as:
- Metrics collection
- Optional diagnostic projections
- Replays for observability/debugging
Logging Behavior:
- If
maxLevelis specified, all errors are logged at that level (e.g.,WARN,DEBUG). - If
maxLevelisnull, 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
Resultmessage but does not halt processing. - The original
retryFunctionis not invoked. - No exceptions are thrown—tracking always continues.
Usage: Can be registered via Consumer.errorHandler() or programmatically via ConsumerConfiguration.
@Consumer(name = "diagnostics", errorHandler = SilentErrorHandler.class)
public class DiagnosticProjection {
@HandleEvent
void on(UserLoggedIn event) {
// An optional diagnostic write may be skipped on failure
}
}
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aSilentErrorHandlerthat 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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ErrorHandler
handleError
-
Constructor Details
-
SilentErrorHandler
public SilentErrorHandler()Constructs aSilentErrorHandlerthat 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:
handleErrorin interfaceErrorHandler- Parameters:
error- theThrowableencountered 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
Resultmessage)
-