org.axonframework.saga
Class SimpleSagaManager

java.lang.Object
  extended by org.axonframework.saga.AbstractSagaManager
      extended by org.axonframework.saga.SimpleSagaManager
All Implemented Interfaces:
EventListener, SagaManager, Subscribable

public class SimpleSagaManager
extends AbstractSagaManager

Simple SagaManager implementation. This implementation requires the Event that should cause new Saga's to be created, to be registered using setEventsToAlwaysCreateNewSagasFor(java.util.List) and setEventsToOptionallyCreateNewSagasFor(java.util.List).

Since:
0.7
Author:
Allard Buijze

Constructor Summary
SimpleSagaManager(Class<? extends Saga> sagaType, SagaRepository sagaRepository, AssociationValueResolver associationValueResolver, EventBus eventBus)
          Initialize a SimpleSagaManager backed by the given resources, using a GenericSagaFactory.
SimpleSagaManager(Class<? extends Saga> sagaType, SagaRepository sagaRepository, AssociationValueResolver associationValueResolver, SagaFactory sagaFactory, EventBus eventBus)
          Initialize a SimpleSagaManager backed by the given resources.
 
Method Summary
protected  Set<Saga> findSagas(Event event)
          Finds the saga instances that the given event needs to be routed to.
 void setEventsToAlwaysCreateNewSagasFor(List<Class<? extends Event>> events)
          Sets the types of Events that should cause the creation of a new Saga instance, even if one already exists.
 void setEventsToOptionallyCreateNewSagasFor(List<Class<? extends Event>> events)
          Sets the types of Events that should cause the creation of a new Saga instance if one does not already exist.
 
Methods inherited from class org.axonframework.saga.AbstractSagaManager
commit, createSaga, getEventBus, getSagaRepository, handle, setSuppressExceptions, setSynchronizeSagaAccess, subscribe, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSagaManager

public SimpleSagaManager(Class<? extends Saga> sagaType,
                         SagaRepository sagaRepository,
                         AssociationValueResolver associationValueResolver,
                         SagaFactory sagaFactory,
                         EventBus eventBus)
Initialize a SimpleSagaManager backed by the given resources.

Parameters:
sagaType - The type of Saga managed by this SagaManager
sagaRepository - The repository providing access to Saga instances
associationValueResolver - The instance providing AssociationValues for incoming Events
sagaFactory - The factory creating new Saga instances
eventBus - The event bus that the manager should register to

SimpleSagaManager

public SimpleSagaManager(Class<? extends Saga> sagaType,
                         SagaRepository sagaRepository,
                         AssociationValueResolver associationValueResolver,
                         EventBus eventBus)
Initialize a SimpleSagaManager backed by the given resources, using a GenericSagaFactory.

Parameters:
sagaType - The type of Saga managed by this SagaManager
sagaRepository - The repository providing access to Saga instances
associationValueResolver - The instance providing AssociationValues for incoming Events
eventBus - The event bus that the manager should register to
Method Detail

findSagas

protected Set<Saga> findSagas(Event event)
Description copied from class: AbstractSagaManager
Finds the saga instances that the given event needs to be routed to. The event is sent to each of the returned instances.

Specified by:
findSagas in class AbstractSagaManager
Parameters:
event - The event to find relevant Sagas for
Returns:
The Set of relevant Sagas

setEventsToAlwaysCreateNewSagasFor

public void setEventsToAlwaysCreateNewSagasFor(List<Class<? extends Event>> events)
Sets the types of Events that should cause the creation of a new Saga instance, even if one already exists.

Parameters:
events - the types of Events that should cause the creation of a new Saga instance, even if one already exists

setEventsToOptionallyCreateNewSagasFor

public void setEventsToOptionallyCreateNewSagasFor(List<Class<? extends Event>> events)
Sets the types of Events that should cause the creation of a new Saga instance if one does not already exist.

Parameters:
events - the types of Events that should cause the creation of a new Saga instance if one does not already exist


Copyright © 2011. All Rights Reserved.