|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.saga.annotation.AsyncAnnotatedSagaManager
public class AsyncAnnotatedSagaManager
A SagaManager implementation that processes Sagas asynchronously. Incoming events are placed on a queue and processed by a given number of processors. Modified saga state is persisted in batches to the repository, to minimize communication overhead with backends.
This SagaManager implementation guarantees a "happens before" type processing for each Saga. That means that the behavior of asynchronously processed events is exactly identical as the behavior if the events were processed completely sequentially.
| Constructor Summary | |
|---|---|
AsyncAnnotatedSagaManager(EventBus eventBus,
Class<? extends AbstractAnnotatedSaga>... sagaTypes)
Initializes an Asynchronous Saga Manager using default values for the given sagaTypes to listen to
events on the given eventBus. |
|
| Method Summary | |
|---|---|
Class<?> |
getTargetType()
Returns the instance type that this proxy delegates all event handling to. |
void |
handle(EventMessage event)
Handles the event by passing it to all Saga instances that have an Association Value found in the given event. |
void |
setBufferSize(int bufferSize)
Sets the size of the processing buffer. |
void |
setExecutor(Executor executor)
Sets the executor that provides the threads for the processors. |
void |
setProcessorCount(int processorCount)
Sets the number of processors (threads) to process events with. |
void |
setSagaFactory(SagaFactory sagaFactory)
Sets the SagaFactory responsible for creating new Saga instances when required. |
void |
setSagaRepository(SagaRepository sagaRepository)
Sets the saga repository to store and load Sagas from. |
void |
setTransactionManager(TransactionManager transactionManager)
Sets the TransactionManager used to manage any transactions required by the underlying storage mechanism. |
void |
setWaitStrategy(com.lmax.disruptor.WaitStrategy waitStrategy)
Sets the WaitStrategy to use when event processors need to wait for incoming events. |
void |
start()
Starts the Saga Manager by starting the processor threads and subscribes it with the eventBus. |
void |
stop()
Unsubscribes this Saga Manager from the event bus and stops accepting new events. |
void |
subscribe()
Subscribe this instance with its configured component. |
void |
unsubscribe()
Unsubscribe this instance from its subscribed component. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AsyncAnnotatedSagaManager(EventBus eventBus,
Class<? extends AbstractAnnotatedSaga>... sagaTypes)
sagaTypes to listen to
events on the given eventBus.
After initialization, the SagaManager must be explicitly started using the start() method.
eventBus - The Event Bus from which the Saga Manager will process eventssagaTypes - The types of Saga this saga manager will process incoming events for| Method Detail |
|---|
public void start()
eventBus. If
the saga manager is already started, it is only re-subscribed to the event bus.
public void stop()
setExecutor(java.util.concurrent.Executor) are not shut down.
If the Saga Manager was already stopped, nothing happens.
public void unsubscribe()
Subscribable
unsubscribe in interface Subscribablepublic void subscribe()
Subscribable
subscribe in interface Subscribablepublic void handle(EventMessage event)
SagaManager
handle in interface EventListenerhandle in interface SagaManagerevent - the event to handlepublic Class<?> getTargetType()
EventListenerProxy
getTargetType in interface EventListenerProxypublic void setExecutor(Executor executor)
executor - the executor that provides the threads for the processorssetProcessorCount(int)public void setSagaRepository(SagaRepository sagaRepository)
sagaRepository - the saga repository to store and load Sagas frompublic void setSagaFactory(SagaFactory sagaFactory)
GenericSagaFactory instance.
sagaFactory - the SagaFactory responsible for creating new Saga instancespublic void setTransactionManager(TransactionManager transactionManager)
transactionManager - the TransactionManager used to manage any transactions required by the underlying
storage mechanism.public void setProcessorCount(int processorCount)
executor is capable of processing this amount of concurrent tasks.
Must be set before the SagaManager is started.
Defaults to 1.
processorCount - the number of processors (threads) to process events withpublic void setBufferSize(int bufferSize)
bufferSize - The size of the processing buffer. Must be a power of 2.public void setWaitStrategy(com.lmax.disruptor.WaitStrategy waitStrategy)
waitStrategy - the WaitStrategy to use when event processors need to wait for incoming events
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||