|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.commandhandling.disruptor.DisruptorConfiguration
public class DisruptorConfiguration
Configuration object for the DisruptorCommandBus. The DisruptorConfiguration provides access to the options to tweak performance settings. Instances are not thread-safe and should not be altered after they have been used to initialize a DisruptorCommandBus.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default size of the buffer in this configuration |
Constructor Summary | |
---|---|
DisruptorConfiguration()
Initializes a configuration instance with default settings: ring-buffer size: 4096, blocking wait strategy and multi-threaded producer type. |
Method Summary | |
---|---|
int |
getBufferSize()
Returns the buffer size to use. |
Cache |
getCache()
Returns the cache used to store Aggregates loaded by the DisruptorCommandBus. |
CommandTargetResolver |
getCommandTargetResolver()
Returns the CommandTargetResolver that is used to find out which Aggregate is to be invoked for a given Command. |
long |
getCoolingDownPeriod()
Returns the cooling down period for the shutdown of the DisruptorCommandBus, in milliseconds. |
List<CommandDispatchInterceptor> |
getDispatchInterceptors()
Returns the dispatch interceptors for the DisruptorCommandBus. |
Executor |
getExecutor()
Returns the Executor providing the processing resources (Threads) for the DisruptorCommandBus. |
List<CommandHandlerInterceptor> |
getInvokerInterceptors()
Returns the interceptors for the DisruptorCommandBus. |
int |
getInvokerThreadCount()
Returns the number of threads to use for Command Handler invocation. |
com.lmax.disruptor.dsl.ProducerType |
getProducerType()
Returns the producer type to use. |
List<CommandHandlerInterceptor> |
getPublisherInterceptors()
Returns the interceptors for the DisruptorCommandBus. |
int |
getPublisherThreadCount()
Returns the number of threads to use for storing and publication of generated Events. |
boolean |
getRescheduleCommandsOnCorruptState()
Indicates whether commands that failed due to potentially corrupt Aggregate state should be automatically rescheduled for processing. |
RollbackConfiguration |
getRollbackConfiguration()
Returns the RollbackConfiguration indicating for which Exceptions the DisruptorCommandBus should perform a rollback, and which exceptions should result in a Commit. |
Class<?> |
getSerializedRepresentation()
Returns the type of data the serialized object should be represented in. |
Serializer |
getSerializer()
Returns the serializer to perform pre-serialization with, or null if no pre-serialization should be
done. |
int |
getSerializerThreadCount()
Returns the configured number of threads that should perform the pre-serialization step. |
TransactionManager |
getTransactionManager()
Returns the transaction manager to use to manage a transaction around the storage and publication of events. |
com.lmax.disruptor.WaitStrategy |
getWaitStrategy()
Returns the WaitStrategy currently configured. |
boolean |
isPreSerializationConfigured()
Indicates whether pre-serialization is configured. |
DisruptorConfiguration |
setBufferSize(int newBufferSize)
Sets the buffer size to use. |
DisruptorConfiguration |
setCache(Cache cache)
Sets the cache in which loaded aggregates will be stored. |
DisruptorConfiguration |
setCommandTargetResolver(CommandTargetResolver newCommandTargetResolver)
Sets the CommandTargetResolver that must be used to indicate which Aggregate instance will be invoked by an incoming command. |
DisruptorConfiguration |
setCoolingDownPeriod(long coolingDownPeriod)
Sets the cooling down period in milliseconds. |
DisruptorConfiguration |
setDispatchInterceptors(List<CommandDispatchInterceptor> dispatchInterceptors)
Configures the CommandDispatchInterceptor to use with the DisruptorCommandBus when commands are dispatched. |
DisruptorConfiguration |
setExecutor(Executor executor)
Sets the Executor that provides the processing resources (Threads) for the components of the DisruptorCommandBus. |
DisruptorConfiguration |
setInvokerInterceptors(List<CommandHandlerInterceptor> invokerInterceptors)
Configures the CommandHandlerInterceptors to use with the DisruptorCommandBus during in the invocation thread. |
DisruptorConfiguration |
setInvokerThreadCount(int count)
Sets the number of Threads that should be used to invoke the Command Handlers. |
DisruptorConfiguration |
setProducerType(com.lmax.disruptor.dsl.ProducerType producerType)
Sets the producer type to use. |
DisruptorConfiguration |
setPublisherInterceptors(List<CommandHandlerInterceptor> publisherInterceptors)
Configures the CommandHandlerInterceptors to use with the DisruptorCommandBus during the publication of changes. |
DisruptorConfiguration |
setPublisherThreadCount(int count)
Sets the number of Threads that should be used to store and publish the generated Events. |
DisruptorConfiguration |
setRescheduleCommandsOnCorruptState(boolean rescheduleCommandsOnCorruptState)
Indicates whether commands that failed because they were executed against potentially corrupted aggregate state should be automatically rescheduled. |
DisruptorConfiguration |
setRollbackConfiguration(RollbackConfiguration rollbackConfiguration)
Sets the rollback configuration for the DisruptorCommandBus to use. |
DisruptorConfiguration |
setSerializedRepresentation(Class<?> newSerializedRepresentation)
Sets the type of data the serialized object should be represented in. |
DisruptorConfiguration |
setSerializer(Serializer newSerializer)
Returns the serializer to perform pre-serialization with, or null if no pre-serialization should be
done. |
DisruptorConfiguration |
setSerializerThreadCount(int newSerializerThreadCount)
Sets the number of threads that should perform the pre-serialization step. |
DisruptorConfiguration |
setTransactionManager(TransactionManager newTransactionManager)
Sets the transaction manager to use to manage a transaction around the storage and publication of events. |
DisruptorConfiguration |
setWaitStrategy(com.lmax.disruptor.WaitStrategy waitStrategy)
Sets the WaitStrategy , which used to make dependent threads wait for tasks to be completed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
---|
public DisruptorConfiguration()
Method Detail |
---|
public com.lmax.disruptor.WaitStrategy getWaitStrategy()
public DisruptorConfiguration setWaitStrategy(com.lmax.disruptor.WaitStrategy waitStrategy)
WaitStrategy
, which used to make dependent threads wait for tasks to be completed. The
choice of strategy mainly depends on the number of processors available and the number of tasks other than the
DisruptorCommandBus
being processed.
The BusySpinWaitStrategy
provides the best throughput at the lowest latency, but also put a big
claim on available CPU resources. The SleepingWaitStrategy
yields lower performance, but leaves
resources available for other processes to use.
Defaults to the BlockingWaitStrategy
.
waitStrategy
- The WaitStrategy to use
this
for method chainingSleepingWaitStrategy
,
BlockingWaitStrategy
,
BusySpinWaitStrategy
,
YieldingWaitStrategy
public Executor getExecutor()
public DisruptorConfiguration setExecutor(Executor executor)
null
, causing the DisruptorCommandBus to create the necessary threads itself. In that
case, threads are created in the DisruptorCommandBus
ThreadGroup.
executor
- the Executor that provides the processing resources
this
for method chainingpublic List<CommandHandlerInterceptor> getInvokerInterceptors()
public DisruptorConfiguration setInvokerInterceptors(List<CommandHandlerInterceptor> invokerInterceptors)
setPublisherInterceptors(java.util.List)
.
invokerInterceptors
- The interceptors to invoke when handling an incoming command
this
for method chainingpublic List<CommandHandlerInterceptor> getPublisherInterceptors()
public DisruptorConfiguration setPublisherInterceptors(List<CommandHandlerInterceptor> publisherInterceptors)
publisherInterceptors
- The interceptors to invoke when handling an incoming command
this
for method chainingpublic List<CommandDispatchInterceptor> getDispatchInterceptors()
public DisruptorConfiguration setDispatchInterceptors(List<CommandDispatchInterceptor> dispatchInterceptors)
dispatchInterceptors
- The dispatch interceptors to invoke when dispatching a command
this
for method chainingpublic RollbackConfiguration getRollbackConfiguration()
public DisruptorConfiguration setRollbackConfiguration(RollbackConfiguration rollbackConfiguration)
RollbackOnUncheckedExceptionConfiguration
a configuration that commits on checked exceptions, and performs a
rollback on runtime exceptions.
rollbackConfiguration
- the RollbackConfiguration indicating for the DisruptorCommandBus
this
for method chainingpublic boolean getRescheduleCommandsOnCorruptState()
true
if commands are automatically rescheduled, otherwise false
public DisruptorConfiguration setRescheduleCommandsOnCorruptState(boolean rescheduleCommandsOnCorruptState)
true
.
rescheduleCommandsOnCorruptState
- whether or not to automatically reschedule commands that failed due to potentially corrupted aggregate
state.
this
for method chainingpublic long getCoolingDownPeriod()
public DisruptorConfiguration setCoolingDownPeriod(long coolingDownPeriod)
coolingDownPeriod
- the cooling down period for the shutdown of the DisruptorCommandBus, in milliseconds.
this
for method chainingpublic Cache getCache()
public DisruptorConfiguration setCache(Cache cache)
cache
- The cache to store loaded aggregates in.
this
for method chainingpublic CommandTargetResolver getCommandTargetResolver()
public DisruptorConfiguration setCommandTargetResolver(CommandTargetResolver newCommandTargetResolver)
invokerThreadCount
, serializerThreadCount
or publisherThreadCount
is greater than 1.
Defaults to an AnnotationCommandTargetResolver
instance.
newCommandTargetResolver
- The CommandTargetResolver to use to indicate which Aggregate instance is target
of an incoming Command
this
for method chainingpublic int getInvokerThreadCount()
public DisruptorConfiguration setInvokerThreadCount(int count)
1 .. ([processor count] / 2)
.
count
- The number of Threads to use for Command Handler invocation
this
for method chainingpublic int getPublisherThreadCount()
public DisruptorConfiguration setPublisherThreadCount(int count)
[processors / 2]
.
count
- The number of Threads to use for publishing
this
for method chainingpublic int getSerializerThreadCount()
setSerializer(org.axonframework.serializer.Serializer)
.
public DisruptorConfiguration setSerializerThreadCount(int newSerializerThreadCount)
setSerializer(org.axonframework.serializer.Serializer)
.
newSerializerThreadCount
- the number of threads to perform pre-serialization with
this
for method chainingpublic Serializer getSerializer()
null
if no pre-serialization should be
done.
null
if no pre-serialization should be
donepublic DisruptorConfiguration setSerializer(Serializer newSerializer)
null
if no pre-serialization should be
done. Defaults to null
.
newSerializer
- the serializer to perform pre-serialization with, or null
if no
pre-serialization
should be done
this
for method chainingpublic boolean isPreSerializationConfigured()
true
when a serializer and at
least one thread is configured.
public Class<?> getSerializedRepresentation()
public DisruptorConfiguration setSerializedRepresentation(Class<?> newSerializedRepresentation)
byte[]
).
newSerializedRepresentation
- the type of data the serialized object should be represented in. May not be
null
.
this
for method chainingpublic TransactionManager getTransactionManager()
null
if none is configured.public DisruptorConfiguration setTransactionManager(TransactionManager newTransactionManager)
null
) is to not have publication and storage of events wrapped in a transaction.
newTransactionManager
- the transaction manager to use to manage a transaction around the storage and
publication of events
this
for method chainingpublic int getBufferSize()
public DisruptorConfiguration setBufferSize(int newBufferSize)
newBufferSize
- the buffer size to use
this
for method chainingpublic com.lmax.disruptor.dsl.ProducerType getProducerType()
public DisruptorConfiguration setProducerType(com.lmax.disruptor.dsl.ProducerType producerType)
producerType
- the producer type to use
this
for method chaining
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |