org.axonframework.saga.annotation
Interface ErrorHandler

All Known Implementing Classes:
ProceedingErrorHandler, RetryingErrorHandler

public interface ErrorHandler

Defines the behavior of a component when an error occurs during Event Processing in a Saga.

Since:
2.4.2
Author:
Allard Buijze

Method Summary
 RetryPolicy onErrorInvoking(Saga saga, EventMessage publishedEvent, int invocationCount, Exception exception)
          Invoked when an error occurs when a Saga instance is invoked.
 RetryPolicy onErrorPreparing(Class<? extends Saga> sagaType, EventMessage<?> publishedEvent, int invocationCount, Exception exception)
          Invoked when an error occurs preparing Sagas.
 

Method Detail

onErrorPreparing

RetryPolicy onErrorPreparing(Class<? extends Saga> sagaType,
                             EventMessage<?> publishedEvent,
                             int invocationCount,
                             Exception exception)
Invoked when an error occurs preparing Sagas. This is the phase where sagas are looked up using their associations.

Parameters:
sagaType - The type of Saga to prepare
publishedEvent - The event being published
invocationCount - The number of attempts to prepare (is always at least 1)
exception - The exception that occurred in this attempt
Returns:
the expected behavior for the event handling component

onErrorInvoking

RetryPolicy onErrorInvoking(Saga saga,
                            EventMessage publishedEvent,
                            int invocationCount,
                            Exception exception)
Invoked when an error occurs when a Saga instance is invoked. These are errors thrown by the Saga itself.

Parameters:
saga - The Saga instance being invoked
publishedEvent - The event handled by the Saga
invocationCount - The number of times this event has been offered to the Saga, including the last, failed, attempt
exception - The exception that occurred in the last attempt to invoke the Saga
Returns:
The Policy describing what the SagaManager should do with this exception (retry, skip, etc)


Copyright © 2010-2016. All Rights Reserved.