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 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 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) {
// Recoverable errors will be logged and processing continues
}
}
- 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)
-