Class LoggingErrorHandler
java.lang.Object
io.fluxzero.sdk.tracking.LoggingErrorHandler
- All Implemented Interfaces:
ErrorHandler
The default
ErrorHandler implementation used by Fluxzero consumers.
This handler logs errors that occur during message tracking and processing, then allows tracking to continue. It is
the recommended starting point for consumer configuration. The failed operation is not retried: a normally completed
batch can advance its position past the failure. Monitor these failures and arrange reconciliation or replay when
needed. Choose ForeverRetryingErrorHandler only for effects whose recoverable failures must hold up progress;
choose ThrowingErrorHandler only when an operator-controlled stop and explicit restart are intended.
Logging Behavior:
- Technical exceptions (i.e., not
FunctionalException) are always logged atERRORlevel. FunctionalExceptions are logged atWARNlevel iflogFunctionalErrorsistrue.- 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
Resultmessage. - The
retryFunctionis 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) {
// Failures are logged; processing continues without retry
}
}
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aLoggingErrorHandlerthat logs both technical and functional errors. -
Method Summary
Modifier and TypeMethodDescriptionhandleError(Throwable error, String errorMessage, Callable<?> retryFunction) Logs the given error and allows tracking to continue.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ErrorHandler
handleError
-
Constructor Details
-
LoggingErrorHandler
public LoggingErrorHandler()Constructs aLoggingErrorHandlerthat logs both technical and functional errors.
-
-
Method Details
-
handleError
Logs the given error and allows tracking to continue.- 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)
-