public static class DistributedCommandBus.Builder extends Object
DistributedCommandBus
.
The CommandCallback
is defaulted to a LoggingCallback
. The MessageMonitor
is defaulted to
a NoOpMessageMonitor
. The CommandBusSpanFactory
is defaulted to a
DefaultCommandBusSpanFactory
backed by a NoOpSpanFactory
. 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. |
DistributedCommandBus.Builder |
spanFactory(CommandBusSpanFactory spanFactory)
Sets the
CommandBusSpanFactory implementation to use for providing tracing capabilities. |
DistributedCommandBus.Builder |
spanFactory(SpanFactory spanFactory)
Deprecated.
Use
spanFactory(CommandBusSpanFactory) instead as it provides more configurability. |
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 a logging 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 command@Deprecated public DistributedCommandBus.Builder spanFactory(@Nonnull SpanFactory spanFactory)
spanFactory(CommandBusSpanFactory)
instead as it provides more configurability.SpanFactory
implementation to use for providing tracing capabilities. Defaults to a
NoOpSpanFactory
by default, which provides no tracing capabilities.spanFactory
- The SpanFactory
implementationpublic DistributedCommandBus.Builder spanFactory(@Nonnull CommandBusSpanFactory spanFactory)
CommandBusSpanFactory
implementation to use for providing tracing capabilities. Defaults to
a DefaultCommandBusSpanFactory
backed by a NoOpSpanFactory
by default, which provides no
tracing capabilities.spanFactory
- The CommandBusSpanFactory
implementationpublic 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–2024. All rights reserved.