public static class SimpleCommandBus.Builder extends Object
SimpleCommandBus
.
The TransactionManager
is defaulted to a NoTransactionManager
, the MessageMonitor
is
defaulted to a NoOpMessageMonitor
, the RollbackConfiguration
defaults to a
RollbackConfigurationType.UNCHECKED_EXCEPTIONS
and the DuplicateCommandHandlerResolver
defaults
to DuplicateCommandHandlerResolution.logAndOverride()
.
The TransactionManager
, MessageMonitor
and RollbackConfiguration
are hard
requirements. Thus setting them to null
will result in an AxonConfigurationException
.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
SimpleCommandBus |
build()
Initializes a
SimpleCommandBus as specified through this Builder. |
SimpleCommandBus.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) . |
SimpleCommandBus.Builder |
duplicateCommandHandlerResolver(DuplicateCommandHandlerResolver duplicateCommandHandlerResolver)
Sets the
DuplicateCommandHandlerResolver used to resolves the road to take when a duplicate command
handler is subscribed. |
SimpleCommandBus.Builder |
messageMonitor(MessageMonitor<? super CommandMessage<?>> messageMonitor)
Sets the
MessageMonitor of generic type CommandMessage used the to monitor the command bus. |
SimpleCommandBus.Builder |
rollbackConfiguration(RollbackConfiguration rollbackConfiguration)
Sets the
RollbackConfiguration which allows you to specify when a UnitOfWork should be rolled
back. |
SimpleCommandBus.Builder |
transactionManager(TransactionManager transactionManager)
Sets the
TransactionManager used to manage transactions. |
protected void |
validate()
Validate whether the fields contained in this Builder as set accordingly.
|
public SimpleCommandBus.Builder transactionManager(TransactionManager transactionManager)
TransactionManager
used to manage transactions. Defaults to a NoTransactionManager
.transactionManager
- a TransactionManager
used to manage transactionspublic SimpleCommandBus.Builder messageMonitor(MessageMonitor<? super CommandMessage<?>> messageMonitor)
MessageMonitor
of generic type CommandMessage
used the to monitor the command bus.
Defaults to a NoOpMessageMonitor
.messageMonitor
- a MessageMonitor
used the message monitor to monitor the command buspublic SimpleCommandBus.Builder rollbackConfiguration(RollbackConfiguration rollbackConfiguration)
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
- a RollbackConfiguration
specifying when a UnitOfWork
should be
rolled backpublic SimpleCommandBus.Builder duplicateCommandHandlerResolver(DuplicateCommandHandlerResolver duplicateCommandHandlerResolver)
DuplicateCommandHandlerResolver
used to resolves the road to take when a duplicate command
handler is subscribed. Defaults to DuplicateCommandHandlerResolution.logAndOverride()
.duplicateCommandHandlerResolver
- a DuplicateCommandHandlerResolver
used to resolves the road to
take when a duplicate command handler is subscribedpublic SimpleCommandBus.Builder defaultCommandCallback(CommandCallback<Object,Object> defaultCommandCallback)
SimpleCommandBus.dispatch(CommandMessage)
. Defaults to a LoggingCallback
. Passing null
will result
in a NoOpCallback
being used.defaultCommandCallback
- the callback to invoke when no explicit callback is provided for a commandpublic SimpleCommandBus build()
SimpleCommandBus
as specified through this Builder.SimpleCommandBus
as specified through this Builderprotected void validate()
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2022. All rights reserved.