public abstract class AbstractSagaManager extends Object implements SagaManager, Subscribable
Constructor and Description |
---|
AbstractSagaManager(EventBus eventBus,
SagaRepository sagaRepository,
SagaFactory sagaFactory,
Class<? extends Saga>... sagaTypes)
Deprecated.
|
AbstractSagaManager(SagaRepository sagaRepository,
SagaFactory sagaFactory,
Class<? extends Saga>... sagaTypes)
Initializes the SagaManager with the given
sagaRepository . |
Modifier and Type | Method and Description |
---|---|
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 |
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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTargetType
@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 Managerpublic 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 instancesprotected 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 informationprotected 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
instanceunsubscribe
in interface Subscribable
@PostConstruct @Deprecated public void subscribe()
EventBus.subscribe(org.axonframework.eventhandling.EventListener)
to subscribe this
instancesubscribe
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.Copyright © 2010-2014. All Rights Reserved.