public class DefaultErrorHandler extends Object implements ErrorHandler
Constructor and Description |
---|
DefaultErrorHandler(RetryPolicy retryPolicy)
Initializes the ErrorHandler, making it return the given
retryPolicy when an error occurs. |
Modifier and Type | Method and Description |
---|---|
RetryPolicy |
handleError(Throwable exception,
EventMessage<?> eventMessage,
EventListener eventListener)
Invoked when a handler or the unit of work throws an exception.
|
public DefaultErrorHandler(RetryPolicy retryPolicy)
retryPolicy
when an error occurs.retryPolicy
- the policy to return on errorspublic RetryPolicy handleError(Throwable exception, EventMessage<?> eventMessage, EventListener eventListener)
ErrorHandler
eventListener
with the given eventMessage
to
attempt to resolve the issue. Do note that the returned policy reflects this, to prevent duplicate invocation of
the listener.
The Error Handler should not throw exceptions.handleError
in interface ErrorHandler
exception
- The exception thrown by the handler (or unit of work)eventMessage
- The message being processedeventListener
- The listener throwing the exception, or null
if an error occurred in the Unit
of WorkCopyright © 2010-2014. All Rights Reserved.