public static class DistributedCommandBus.Builder extends Object
DistributedCommandBus.
The MessageMonitor is defaulted to a NoOpMessageMonitor. The CommandRouter and CommandBusConnector are hard requirements and as such should be provided.
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
DistributedCommandBus |
build()
Initializes a
DistributedCommandBus as specified through this Builder. |
DistributedCommandBus.Builder |
commandRouter(CommandRouter commandRouter)
Sets the
CommandRouter used to determine the target node for each dispatched command. |
DistributedCommandBus.Builder |
connector(CommandBusConnector connector)
Sets the
CommandBusConnector which performs the actual transport of the message to the destination
node. |
DistributedCommandBus.Builder |
defaultCommandCallback(CommandCallback<Object,Object> defaultCommandCallback)
Sets the callback to use when commands are dispatched in a "fire and forget" method, such as
DistributedCommandBus.dispatch(CommandMessage). |
DistributedCommandBus.Builder |
messageMonitor(MessageMonitor<? super CommandMessage<?>> messageMonitor)
Sets the
MessageMonitor for generic types implementing CommandMessage, which is used to
monitor incoming messages and their execution result. |
protected void |
validate()
Validate whether the fields contained in this Builder as set accordingly.
|
public DistributedCommandBus.Builder commandRouter(CommandRouter commandRouter)
CommandRouter used to determine the target node for each dispatched command.commandRouter - a CommandRouter used to determine the target node for each dispatched commandpublic DistributedCommandBus.Builder connector(CommandBusConnector connector)
CommandBusConnector which performs the actual transport of the message to the destination
node.connector - a CommandBusConnector which performs the actual transport of the message to the
destination nodepublic DistributedCommandBus.Builder messageMonitor(MessageMonitor<? super CommandMessage<?>> messageMonitor)
MessageMonitor for generic types implementing CommandMessage, which is used to
monitor incoming messages and their execution result.messageMonitor - a MessageMonitor used to monitor incoming messages and their execution resultpublic DistributedCommandBus.Builder defaultCommandCallback(CommandCallback<Object,Object> defaultCommandCallback)
DistributedCommandBus.dispatch(CommandMessage). Defaults to using no callback, which requests the connectors to use a
fire-and-forget strategy for dispatching event.defaultCommandCallback - the callback to invoke when no explicit callback is provided for a commandpublic DistributedCommandBus build()
DistributedCommandBus as specified through this Builder.DistributedCommandBus as specified through this Builderprotected void validate()
AxonConfigurationException - if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2023. All rights reserved.