|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.saga.AbstractReplayAwareSagaManager org.axonframework.saga.AbstractSagaManager
public abstract class AbstractSagaManager
Abstract implementation of the SagaManager interface that provides basic functionality required by most SagaManager implementations. Provides support for Saga lifecycle management and asynchronous handling of events.
Constructor Summary | |
---|---|
AbstractSagaManager(EventBus eventBus,
SagaRepository sagaRepository,
SagaFactory sagaFactory,
Class<? extends Saga>... sagaTypes)
Deprecated. use AbstractSagaManager(SagaRepository, SagaFactory, Class[]) and register using EventBus.subscribe(org.axonframework.eventhandling.EventListener) |
|
AbstractSagaManager(SagaRepository sagaRepository,
SagaFactory sagaFactory,
Class<? extends Saga>... sagaTypes)
Initializes the SagaManager with the given sagaRepository . |
Method Summary | |
---|---|
protected void |
commit(Saga saga)
Commits the given saga to the registered repository. |
protected abstract Set<AssociationValue> |
extractAssociationValues(Class<? extends Saga> sagaType,
EventMessage event)
Extracts the AssociationValues from the given event as relevant for a Saga of given
sagaType . |
Set<Class<? extends Saga>> |
getManagedSagaTypes()
Returns the set of Saga types managed by this instance. |
protected abstract SagaInitializationPolicy |
getSagaCreationPolicy(Class<? extends Saga> sagaType,
EventMessage event)
Returns the Saga Initialization Policy for a Saga of the given sagaType and event . |
void |
handle(EventMessage event)
Handles the event by passing it to all Saga instances that have an Association Value found in the given event. |
protected void |
preProcessSaga(Saga saga)
Perform pre-processing of sagas that have been newly created or have been loaded from the repository. |
void |
setCorrelationDataProvider(CorrelationDataProvider<? super EventMessage> correlationDataProvider)
Sets the correlation data provider for this SagaManager. |
void |
setCorrelationDataProviders(List<? extends CorrelationDataProvider<? super EventMessage>> correlationDataProviders)
Sets the given correlationDataProviders . |
void |
setSuppressExceptions(boolean suppressExceptions)
Sets whether or not to suppress any exceptions that are cause by invoking Sagas. |
void |
setSynchronizeSagaAccess(boolean synchronizeSagaAccess)
Sets whether of not access to Saga's Event Handler should by synchronized. |
void |
subscribe()
Deprecated. Use EventBus.subscribe(org.axonframework.eventhandling.EventListener) to subscribe this
instance |
void |
unsubscribe()
Deprecated. Use EventBus.unsubscribe(org.axonframework.eventhandling.EventListener) to unsubscribe this
instance |
Methods inherited from class org.axonframework.saga.AbstractReplayAwareSagaManager |
---|
afterReplay, beforeReplay, onReplayFailed, setReplayable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.axonframework.eventhandling.EventListenerProxy |
---|
getTargetType |
Constructor Detail |
---|
@Deprecated public AbstractSagaManager(EventBus eventBus, SagaRepository sagaRepository, SagaFactory sagaFactory, Class<? extends Saga>... sagaTypes)
AbstractSagaManager(SagaRepository, SagaFactory, Class[])
and register using EventBus.subscribe(org.axonframework.eventhandling.EventListener)
eventBus
and sagaRepository
.
eventBus
- The event bus providing the events to route to sagas.sagaRepository
- The repository providing the saga instances.sagaFactory
- The factory providing new saga instancessagaTypes
- The types of Saga supported by this Saga Managerpublic AbstractSagaManager(SagaRepository sagaRepository, SagaFactory sagaFactory, Class<? extends Saga>... sagaTypes)
sagaRepository
.
sagaRepository
- The repository providing the saga instances.sagaFactory
- The factory providing new saga instancessagaTypes
- The types of Saga supported by this Saga ManagerMethod Detail |
---|
public void handle(EventMessage event)
SagaManager
handle
in interface EventListener
handle
in interface SagaManager
event
- the event to handleprotected abstract SagaInitializationPolicy getSagaCreationPolicy(Class<? extends Saga> sagaType, EventMessage event)
sagaType
and event
.
This policy provides the conditions to create new Saga instance, as well as the initial association of that
saga.
sagaType
- The type of Saga to get the creation policy forevent
- The Event that is being dispatched to Saga instances
protected abstract Set<AssociationValue> extractAssociationValues(Class<? extends Saga> sagaType, EventMessage event)
event
as relevant for a Saga of given
sagaType
. A single event may be associated with multiple values.
sagaType
- The type of Saga about to handle the Eventevent
- The event containing the association information
protected void preProcessSaga(Saga saga)
saga
- The saga instance for pre-processingprotected void commit(Saga saga)
saga
to the registered repository.
saga
- the Saga to commit.@PreDestroy @Deprecated public void unsubscribe()
EventBus.unsubscribe(org.axonframework.eventhandling.EventListener)
to unsubscribe this
instance
unsubscribe
in interface Subscribable
@PostConstruct @Deprecated public void subscribe()
EventBus.subscribe(org.axonframework.eventhandling.EventListener)
to subscribe this
instance
subscribe
in interface Subscribable
public void setSuppressExceptions(boolean suppressExceptions)
true
.
suppressExceptions
- whether or not to suppress exceptions from Sagas.public void setSynchronizeSagaAccess(boolean synchronizeSagaAccess)
true
. Sets
to false
only if the Saga managed by this manager are completely thread safe by themselves.
synchronizeSagaAccess
- whether or not to synchronize access to Saga's event handlers.public void setCorrelationDataProvider(CorrelationDataProvider<? super EventMessage> correlationDataProvider)
correlationDataProvider
- the correlation data provider for this SagaManagerpublic void setCorrelationDataProviders(List<? extends CorrelationDataProvider<? super EventMessage>> correlationDataProviders)
correlationDataProviders
. Each will provide data to attach to messages sent by Sagas
managed by this manager. When multiple providers provide different values for the same key, the latter provider
will overwrite any values set earlier.
correlationDataProviders
- the correlation data providers for this SagaManagerpublic Set<Class<? extends Saga>> getManagedSagaTypes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |