public class AsyncAnnotatedSagaManager extends Object implements SagaManager, Subscribable, EventProcessingMonitorSupport
Constructor and Description |
---|
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 . |
Modifier and Type | Method and Description |
---|---|
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) |
void |
setCorrelationDataProviders(List<? extends CorrelationDataProvider<? super EventMessage>> correlationDataProviders) |
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 . |
@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 forpublic 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 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)
public void setCorrelationDataProviders(List<? extends CorrelationDataProvider<? super EventMessage>> correlationDataProviders)
Copyright © 2010-2014. All Rights Reserved.