Class DefaultCommandGateway.Builder
java.lang.Object
org.axonframework.commandhandling.gateway.AbstractCommandGateway.Builder
org.axonframework.commandhandling.gateway.DefaultCommandGateway.Builder
- Enclosing class:
DefaultCommandGateway
Builder class to instantiate a
DefaultCommandGateway.
The dispatchInterceptors are defaulted to an empty list.
The CommandBus is a hard requirements and as such should be provided.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aDefaultCommandGatewayas specified through this Builder.commandBus(CommandBus commandBus) Sets theCommandBusused to dispatch commands.commandCallback(CommandCallback<Object, Object> commandCallback) Set aCommandCallbackon the command bus.dispatchInterceptors(List<MessageDispatchInterceptor<? super CommandMessage<?>>> dispatchInterceptors) dispatchInterceptors(MessageDispatchInterceptor<? super CommandMessage<?>>... dispatchInterceptors) retryScheduler(RetryScheduler retryScheduler) Sets theRetrySchedulercapable of performing retries of failed commands.Methods inherited from class org.axonframework.commandhandling.gateway.AbstractCommandGateway.Builder
validate
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
commandBus
Description copied from class:AbstractCommandGateway.BuilderSets theCommandBusused to dispatch commands.- Overrides:
commandBusin classAbstractCommandGateway.Builder- Parameters:
commandBus- aCommandBusused to dispatch commands- Returns:
- the current Builder instance, for fluent interfacing
-
commandCallback
public DefaultCommandGateway.Builder commandCallback(CommandCallback<Object, Object> commandCallback) Set aCommandCallbackon the command bus. This will be used as callback for all asynchronous commands that are sent. By default, theFailureLoggingCallbackis used. This will log to the default logger on failure.- Parameters:
commandCallback- TheCommandCallbackto use for asynchronous commands- Returns:
- the current Builder instance, for fluent interfacing
-
retryScheduler
Description copied from class:AbstractCommandGateway.BuilderSets theRetrySchedulercapable of performing retries of failed commands. May benullwhen to prevent retries.- Overrides:
retrySchedulerin classAbstractCommandGateway.Builder- Parameters:
retryScheduler- aRetrySchedulercapable of performing retries of failed commands- Returns:
- the current Builder instance, for fluent interfacing
-
dispatchInterceptors
public DefaultCommandGateway.Builder dispatchInterceptors(MessageDispatchInterceptor<? super CommandMessage<?>>... dispatchInterceptors) Description copied from class:AbstractCommandGateway.BuilderSets theListofMessageDispatchInterceptors forCommandMessages. Are invoked when a command is being dispatched.- Overrides:
dispatchInterceptorsin classAbstractCommandGateway.Builder- Parameters:
dispatchInterceptors- which are invoked when a command is being dispatched- Returns:
- the current Builder instance, for fluent interfacing
-
dispatchInterceptors
public DefaultCommandGateway.Builder dispatchInterceptors(List<MessageDispatchInterceptor<? super CommandMessage<?>>> dispatchInterceptors) Description copied from class:AbstractCommandGateway.BuilderSets theListofMessageDispatchInterceptors forCommandMessages. Are invoked when a command is being dispatched.- Overrides:
dispatchInterceptorsin classAbstractCommandGateway.Builder- Parameters:
dispatchInterceptors- which are invoked when a command is being dispatched- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aDefaultCommandGatewayas specified through this Builder.- Returns:
- a
DefaultCommandGatewayas specified through this Builder
-