Class LoggingErrorHandler
java.lang.Object
io.fluxcapacitor.javaclient.tracking.LoggingErrorHandler
- All Implemented Interfaces:
ErrorHandler
The default
ErrorHandler
implementation used by Flux Capacitor 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 atERROR
level. FunctionalException
s are logged atWARN
level iflogFunctionalErrors
istrue
.- 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
Result
message. - The
retryFunction
is 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 aLoggingErrorHandler
that 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 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
-
LoggingErrorHandler
public LoggingErrorHandler()Constructs aLoggingErrorHandler
that logs both technical and functional errors.
-
-
Method Details
-
handleError
Logs the given error and allows tracking to continue.- 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)
-