|
||||||||||
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.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 back-ends.
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(Class<? extends AbstractAnnotatedSaga>... sagaTypes)
Initializes an Asynchronous Saga Manager using default values for the given sagaTypes . |
|
AsyncAnnotatedSagaManager(EventBus eventBus,
Class<? extends AbstractAnnotatedSaga>... sagaTypes)
Deprecated. use AsyncAnnotatedSagaManager(Class[]) and register with the event bus using EventBus.subscribe(org.axonframework.eventhandling.EventListener) |
|
AsyncAnnotatedSagaManager(ParameterResolverFactory parameterResolverFactory,
Class<? extends AbstractAnnotatedSaga>... sagaTypes)
Initializes an Asynchronous Saga Manager using default values for the given sagaTypes . |
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 |
setCorrelationDataProvider(CorrelationDataProvider<? super EventMessage> correlationDataProvider)
Sets the CorrelationDataProvider which provides the Meta Data to assign to messages generated by the Sagas that are managed by this SagaManager instance. |
void |
setCorrelationDataProviders(List<? extends CorrelationDataProvider<? super EventMessage>> correlationDataProviders)
Sets the CorrelationDataProviders which provide the Meta Data to assign to messages generated by the Sagas that are managed by this SagaManager instance. |
void |
setErrorHandler(ErrorHandler errorHandler)
Sets the ErrorHandler instance, which defines the behavior in case an error occurs while loading or invoking Sagas for an incoming Event. |
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 |
setStartTimeout(long startTimeout)
Sets the amount of time (in milliseconds) the AsyncSagaManager will wait for the async processors to be assigned a thread from the executor. |
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 |
subscribeEventProcessingMonitor(EventProcessingMonitor monitor)
Subscribes the given monitor . |
void |
unsubscribe()
Unsubscribe this instance from its subscribed component. |
void |
unsubscribeEventProcessingMonitor(EventProcessingMonitor monitor)
Unsubscribed the given monitor . |
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 |
Constructor Detail |
---|
@Deprecated public AsyncAnnotatedSagaManager(EventBus eventBus, Class<? extends AbstractAnnotatedSaga>... sagaTypes)
AsyncAnnotatedSagaManager(Class[])
and register with the event bus using EventBus.subscribe(org.axonframework.eventhandling.EventListener)
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 forpublic AsyncAnnotatedSagaManager(Class<? extends AbstractAnnotatedSaga>... sagaTypes)
sagaTypes
.
After initialization, the SagaManager must be explicitly started using the start()
method.
sagaTypes
- The types of Saga this saga manager will process incoming events forpublic AsyncAnnotatedSagaManager(ParameterResolverFactory parameterResolverFactory, Class<? extends AbstractAnnotatedSaga>... sagaTypes)
sagaTypes
.
After initialization, the SagaManager must be explicitly started using the start()
method.
parameterResolverFactory
- The parameter resolver factory to resolve parameters of annotated handlerssagaTypes
- The types of Saga this saga manager will process incoming events forMethod 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 Subscribable
public void subscribe()
Subscribable
subscribe
in interface Subscribable
public void handle(EventMessage event)
SagaManager
handle
in interface EventListener
handle
in interface SagaManager
event
- the event to handlepublic Class<?> getTargetType()
EventListenerProxy
getTargetType
in interface EventListenerProxy
public void subscribeEventProcessingMonitor(EventProcessingMonitor monitor)
EventProcessingMonitorSupport
monitor
. If the monitor is already subscribed, nothing happens.
subscribeEventProcessingMonitor
in interface EventProcessingMonitorSupport
monitor
- The monitor to subscribepublic void unsubscribeEventProcessingMonitor(EventProcessingMonitor monitor)
EventProcessingMonitorSupport
monitor
. If the monitor was not subscribed, or was already unsubscribed,
nothing happens.
unsubscribeEventProcessingMonitor
in interface EventProcessingMonitorSupport
monitor
- The monitor to unsubscribepublic 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 setErrorHandler(ErrorHandler errorHandler)
errorHandler
- the error handler to notify when an error occurspublic 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 setStartTimeout(long startTimeout)
start()
. Defaults to 5000 (5 seconds).
startTimeout
- the number of millis to wait for the processor to have been assigned a thread. Defaults to
5000 (5 seconds).public 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 eventspublic void setCorrelationDataProvider(CorrelationDataProvider<? super EventMessage> correlationDataProvider)
correlationDataProvider
- the instance that provides the information to attach as correlation datapublic void setCorrelationDataProviders(List<? extends CorrelationDataProvider<? super EventMessage>> correlationDataProviders)
correlationDataProviders
- a list of instances that provides the information to attach as correlation data
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |