Class AbstractCommandGateway.Builder
java.lang.Object
org.axonframework.commandhandling.gateway.AbstractCommandGateway.Builder
- Direct Known Subclasses:
DefaultCommandGateway.Builder
- Enclosing class:
AbstractCommandGateway
Abstract Builder class to instantiate
AbstractCommandGateway implementations.
The dispatchInterceptors are defaulted to an empty list.
The CommandBus is a hard requirement and as such should be provided.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncommandBus(CommandBus commandBus) Sets theCommandBusused to dispatch commands.dispatchInterceptors(List<MessageDispatchInterceptor<? super CommandMessage<?>>> dispatchInterceptors) dispatchInterceptors(MessageDispatchInterceptor<? super CommandMessage<?>>... dispatchInterceptors) retryScheduler(RetryScheduler retryScheduler) Sets theRetrySchedulercapable of performing retries of failed commands.protected voidvalidate()Validate whether the fields contained in this Builder as set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
commandBus
Sets theCommandBusused to dispatch commands.- Parameters:
commandBus- aCommandBusused to dispatch commands- Returns:
- the current Builder instance, for fluent interfacing
-
retryScheduler
Sets theRetrySchedulercapable of performing retries of failed commands. May benullwhen to prevent retries.- Parameters:
retryScheduler- aRetrySchedulercapable of performing retries of failed commands- Returns:
- the current Builder instance, for fluent interfacing
-
dispatchInterceptors
public AbstractCommandGateway.Builder dispatchInterceptors(MessageDispatchInterceptor<? super CommandMessage<?>>... dispatchInterceptors) Sets theListofMessageDispatchInterceptors forCommandMessages. Are invoked when a command is being dispatched.- Parameters:
dispatchInterceptors- which are invoked when a command is being dispatched- Returns:
- the current Builder instance, for fluent interfacing
-
dispatchInterceptors
public AbstractCommandGateway.Builder dispatchInterceptors(List<MessageDispatchInterceptor<? super CommandMessage<?>>> dispatchInterceptors) Sets theListofMessageDispatchInterceptors forCommandMessages. Are invoked when a command is being dispatched.- Parameters:
dispatchInterceptors- which are invoked when a command is being dispatched- Returns:
- the current Builder instance, for fluent interfacing
-
validate
protected void validate()Validate whether the fields contained in this Builder as set accordingly.- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-