org.axonframework.eventhandling.async
Interface ErrorHandler

All Known Implementing Classes:
DefaultErrorHandler

public interface ErrorHandler

Interface describing a mechanism that decides what should happen when an asynchronously handled event raises an error.

Since:
2.0
Author:
Allard Buijze

Method Summary
 RetryPolicy handleError(Throwable exception, EventMessage<?> eventMessage, EventListener eventListener)
          Invoked when a handler or the unit of work throws an exception.
 

Method Detail

handleError

RetryPolicy handleError(Throwable exception,
                        EventMessage<?> eventMessage,
                        EventListener eventListener)
Invoked when a handler or the unit of work throws an exception. The returned RetryPolicy tells the Event Processor what to do to resolve the issue (commit or rollback Unit of Work, reschedule or skip the Event).

The Error Handler may invoke the given 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.

Parameters:
exception - The exception thrown by the handler (or unit of work)
eventMessage - The message being processed
eventListener - The listener throwing the exception, or null if an error occurred in the Unit of Work
Returns:
the policy the Event Processor should apply to resolve the issue


Copyright © 2010-2016. All Rights Reserved.