Interface ExceptionHandler
public interface ExceptionHandler
Strategy for handling exceptions that arise in asynchronous or background processing where a normal exception
propagation path does not exist, such as in a
Consumer's polling thread.
Unlike the route-level ErrorHandler, which handles exceptions thrown by processors inside a route,
ExceptionHandler is used by infrastructure code (consumers, schedulers, Quartz jobs, background threads) that
cannot propagate exceptions through the normal routing chain. The default implementation logs the exception and
continues; custom implementations can re-route, alert, or escalate as needed.
Implementations must not throw exceptions from their handleException methods, because the handler is
typically called from within an existing catch block and a secondary exception would mask the original failure.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidhandleException(@Nullable String message, Throwable exception) Handles the given exceptionvoidhandleException(@Nullable String message, @Nullable Exchange exchange, Throwable exception) Handles the given exceptionvoidhandleException(Throwable exception) Handles the given exception
-
Method Details
-
handleException
Handles the given exception- Parameters:
exception- the exception
-
handleException
-
handleException
-