public static class AsynchronousCommandBus.Builder extends SimpleCommandBus.Builder
AsynchronousCommandBus.
The TransactionManager, MessageMonitor, RollbackConfiguration,
DuplicateCommandHandlerResolver, SpanFactory and Executor are respectively defaulted to a
NoTransactionManager, a NoOpMessageMonitor, a
RollbackConfigurationType.UNCHECKED_EXCEPTIONS, a
DuplicateCommandHandlerResolution.logAndOverride(), NoOpSpanFactory 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 |
spanFactory(SpanFactory spanFactory)
Sets the
SpanFactory implementation to use for providing tracing capabilities. |
AsynchronousCommandBus.Builder |
transactionManager(TransactionManager transactionManager)
Sets the
TransactionManager used to manage transactions. |
validatepublic AsynchronousCommandBus.Builder transactionManager(@Nonnull TransactionManager transactionManager)
SimpleCommandBus.BuilderTransactionManager used to manage transactions. Defaults to a NoTransactionManager.transactionManager in class SimpleCommandBus.BuildertransactionManager - a TransactionManager used to manage transactionspublic AsynchronousCommandBus.Builder messageMonitor(@Nonnull MessageMonitor<? super CommandMessage<?>> messageMonitor)
SimpleCommandBus.BuilderMessageMonitor of generic type CommandMessage used the to monitor the command bus.
Defaults to a NoOpMessageMonitor.messageMonitor in class SimpleCommandBus.BuildermessageMonitor - a MessageMonitor used the message monitor to monitor the command buspublic AsynchronousCommandBus.Builder rollbackConfiguration(@Nonnull RollbackConfiguration rollbackConfiguration)
SimpleCommandBus.BuilderRollbackConfiguration 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.BuilderrollbackConfiguration - a RollbackConfiguration specifying when a UnitOfWork should be
rolled backpublic AsynchronousCommandBus.Builder defaultCommandCallback(@Nonnull CommandCallback<Object,Object> defaultCommandCallback)
SimpleCommandBus.BuilderSimpleCommandBus.dispatch(CommandMessage). Defaults to a LoggingCallback. Passing null will result in a
NoOpCallback being used.defaultCommandCallback in class SimpleCommandBus.BuilderdefaultCommandCallback - the callback to invoke when no explicit callback is provided for a commandpublic AsynchronousCommandBus.Builder duplicateCommandHandlerResolver(@Nonnull DuplicateCommandHandlerResolver duplicateCommandHandlerResolver)
SimpleCommandBus.BuilderDuplicateCommandHandlerResolver used to resolves the road to take when a duplicate command
handler is subscribed. Defaults to DuplicateCommandHandlerResolution.logAndOverride().duplicateCommandHandlerResolver in class SimpleCommandBus.BuilderduplicateCommandHandlerResolver - a DuplicateCommandHandlerResolver used to resolves the road to
take when a duplicate command handler is subscribedpublic AsynchronousCommandBus.Builder spanFactory(@Nonnull SpanFactory spanFactory)
SimpleCommandBus.BuilderSpanFactory implementation to use for providing tracing capabilities. Defaults to a
NoOpSpanFactory by default, which provides no tracing capabilities.spanFactory in class SimpleCommandBus.BuilderspanFactory - The SpanFactory implementation.public 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.BuilderAsynchronousCommandBus as specified through this BuilderCopyright © 2010–2023. All rights reserved.