public abstract class AbstractSagaManager<T> extends Object implements EventHandlerInvoker
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSagaManager(Class<T> sagaType,
SagaRepository<T> sagaRepository,
Supplier<T> sagaFactory)
Initializes the SagaManager with the given
sagaRepository. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Set<AssociationValue> |
extractAssociationValues(EventMessage<?> event)
Extracts the AssociationValues from the given
event as relevant for a Saga of given
sagaType. |
protected abstract SagaInitializationPolicy |
getSagaCreationPolicy(EventMessage<?> event)
Returns the Saga Initialization Policy for a Saga of the given
sagaType and event. |
Class<T> |
getSagaType()
Returns the class of Saga managed by this SagaManager
|
Object |
handle(EventMessage<?> event)
Handles the given
message. |
void |
setSuppressExceptions(boolean suppressExceptions)
Sets whether or not to suppress any exceptions that are cause by invoking Sagas.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasHandlerprotected AbstractSagaManager(Class<T> sagaType, SagaRepository<T> sagaRepository, Supplier<T> sagaFactory)
sagaRepository.sagaType - The type of Saga Managed by this instancesagaRepository - The repository providing the saga instances.sagaFactory - The factory responsible for creating new Saga instancespublic Object handle(EventMessage<?> event) throws Exception
MessageHandlermessage.handle in interface MessageHandler<EventMessage<?>>event - The message to be processed.Exception - any exception that occurs during message handlingprotected abstract SagaInitializationPolicy getSagaCreationPolicy(EventMessage<?> event)
sagaType and event. This
policy provides the conditions to create new Saga instance, as well as the initial association of that saga.event - The Event that is being dispatched to Saga instancesprotected abstract Set<AssociationValue> extractAssociationValues(EventMessage<?> event)
event as relevant for a Saga of given
sagaType. A single event may be associated with multiple values.event - The event containing the association informationpublic void setSuppressExceptions(boolean suppressExceptions)
true.suppressExceptions - whether or not to suppress exceptions from Sagas.Copyright © 2010–2017. All rights reserved.