public static class AsynchronousCommandBus.Builder extends SimpleCommandBus.Builder
AsynchronousCommandBus
.
The TransactionManager
, MessageMonitor
, RollbackConfiguration
,
DuplicateCommandHandlerResolver
and Executor
are respectively defaulted to a
NoTransactionManager
, a NoOpMessageMonitor
, a
RollbackConfigurationType.UNCHECKED_EXCEPTIONS
, a
DuplicateCommandHandlerResolution.logAndOverride()
and a Executors.newCachedThreadPool()
.
The default executor
uses an AxonThreadFactory
to create threads with a sensible naming scheme.
The TransactionManager, MessageMonitor, RollbackConfiguration and Executor are hard requirements. Thus
setting them to null
will result in an AxonConfigurationException
.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
AsynchronousCommandBus |
build()
Initializes a
AsynchronousCommandBus as specified through this Builder. |
AsynchronousCommandBus.Builder |
defaultCommandCallback(CommandCallback<Object,Object> defaultCommandCallback)
Sets the callback to use when commands are dispatched in a "fire and forget" method, such as
SimpleCommandBus.dispatch(CommandMessage) . |
AsynchronousCommandBus.Builder |
duplicateCommandHandlerResolver(DuplicateCommandHandlerResolver duplicateCommandHandlerResolver)
Sets the
DuplicateCommandHandlerResolver used to resolves the road to take when a duplicate command
handler is subscribed. |
AsynchronousCommandBus.Builder |
executor(Executor executor)
Sets the
Executor which processes the Command dispatching threads. |
AsynchronousCommandBus.Builder |
messageMonitor(MessageMonitor<? super CommandMessage<?>> messageMonitor)
Sets the
MessageMonitor of generic type CommandMessage used the to monitor the command bus. |
AsynchronousCommandBus.Builder |
rollbackConfiguration(RollbackConfiguration rollbackConfiguration)
Sets the
RollbackConfiguration which allows you to specify when a UnitOfWork should be rolled
back. |
AsynchronousCommandBus.Builder |
transactionManager(TransactionManager transactionManager)
Sets the
TransactionManager used to manage transactions. |
validate
public AsynchronousCommandBus.Builder transactionManager(TransactionManager transactionManager)
SimpleCommandBus.Builder
TransactionManager
used to manage transactions. Defaults to a NoTransactionManager
.transactionManager
in class SimpleCommandBus.Builder
transactionManager
- a TransactionManager
used to manage transactionspublic AsynchronousCommandBus.Builder messageMonitor(MessageMonitor<? super CommandMessage<?>> messageMonitor)
SimpleCommandBus.Builder
MessageMonitor
of generic type CommandMessage
used the to monitor the command bus.
Defaults to a NoOpMessageMonitor
.messageMonitor
in class SimpleCommandBus.Builder
messageMonitor
- a MessageMonitor
used the message monitor to monitor the command buspublic AsynchronousCommandBus.Builder rollbackConfiguration(RollbackConfiguration rollbackConfiguration)
SimpleCommandBus.Builder
RollbackConfiguration
which allows you to specify when a UnitOfWork
should be rolled
back. Defaults to a RollbackConfigurationType.UNCHECKED_EXCEPTIONS
, which triggers a rollback on all
unchecked exceptions.rollbackConfiguration
in class SimpleCommandBus.Builder
rollbackConfiguration
- a RollbackConfiguration
specifying when a UnitOfWork
should be
rolled backpublic AsynchronousCommandBus.Builder defaultCommandCallback(CommandCallback<Object,Object> defaultCommandCallback)
SimpleCommandBus.Builder
SimpleCommandBus.dispatch(CommandMessage)
. Defaults to a LoggingCallback
. Passing null
will result
in a NoOpCallback
being used.defaultCommandCallback
in class SimpleCommandBus.Builder
defaultCommandCallback
- the callback to invoke when no explicit callback is provided for a commandpublic AsynchronousCommandBus.Builder duplicateCommandHandlerResolver(DuplicateCommandHandlerResolver duplicateCommandHandlerResolver)
SimpleCommandBus.Builder
DuplicateCommandHandlerResolver
used to resolves the road to take when a duplicate command
handler is subscribed. Defaults to DuplicateCommandHandlerResolution.logAndOverride()
.duplicateCommandHandlerResolver
in class SimpleCommandBus.Builder
duplicateCommandHandlerResolver
- a DuplicateCommandHandlerResolver
used to resolves the road to
take when a duplicate command handler is subscribedpublic AsynchronousCommandBus.Builder executor(Executor executor)
Executor
which processes the Command dispatching threads.executor
- a Executor
to processes the Command dispatching threadspublic AsynchronousCommandBus build()
AsynchronousCommandBus
as specified through this Builder.build
in class SimpleCommandBus.Builder
AsynchronousCommandBus
as specified through this BuilderCopyright © 2010–2020. All rights reserved.