Class CommandGatewayFactory.Builder
java.lang.Object
org.axonframework.commandhandling.gateway.CommandGatewayFactory.Builder
- Enclosing class:
CommandGatewayFactory
Builder class to instantiate a
CommandGatewayFactory.
The CommandBus is a hard requirements and as such should be provided.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aCommandGatewayFactoryas specified through this Builder.commandBus(CommandBus commandBus) Sets theCommandBuson which to dispatchCommandMessages.dispatchInterceptors(List<MessageDispatchInterceptor<? super CommandMessage<?>>> dispatchInterceptors) Sets theMessageDispatchInterceptors which are invoked before dispatching aCommandMessageon theCommandBus.dispatchInterceptors(MessageDispatchInterceptor<? super CommandMessage<?>>... dispatchInterceptors) Sets theMessageDispatchInterceptors which are invoked before dispatching aCommandMessageon theCommandBus.retryScheduler(RetryScheduler retryScheduler) Sets theRetrySchedulerwhich will decide whether to reschedule commands.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
commandBus
Sets theCommandBuson which to dispatchCommandMessages.- Parameters:
commandBus- TheCommandBuson which to dispatchCommandMessages.- Returns:
- The current Builder instance, for fluent interfacing.
-
retryScheduler
Sets theRetrySchedulerwhich will decide whether to reschedule commands. May benullto report failures without rescheduling.- Parameters:
retryScheduler- TheRetrySchedulerwhich will decide whether to reschedule commands.- Returns:
- The current Builder instance, for fluent interfacing.
-
dispatchInterceptors
public CommandGatewayFactory.Builder dispatchInterceptors(MessageDispatchInterceptor<? super CommandMessage<?>>... dispatchInterceptors) Sets theMessageDispatchInterceptors which are invoked before dispatching aCommandMessageon theCommandBus. Note that the givendispatchInterceptorsare applied only on commands sent through gateways that have been created using this factory.- Parameters:
dispatchInterceptors- An array ofMessageDispatchInterceptors which are invoked before dispatching aCommandMessageon theCommandBus.- Returns:
- The current Builder instance, for fluent interfacing.
-
dispatchInterceptors
public CommandGatewayFactory.Builder dispatchInterceptors(List<MessageDispatchInterceptor<? super CommandMessage<?>>> dispatchInterceptors) Sets theMessageDispatchInterceptors which are invoked before dispatching aCommandMessageon theCommandBus. Note that the givendispatchInterceptorsare applied only on commands sent through gateways that have been created using this factory.- Parameters:
dispatchInterceptors- AListofMessageDispatchInterceptors which are invoked before dispatching aCommandMessageon theCommandBus.- Returns:
- The current Builder instance, for fluent interfacing.
-
build
Initializes aCommandGatewayFactoryas specified through this Builder.- Returns:
- A
CommandGatewayFactoryas specified through this Builder.
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Throws:
AxonConfigurationException- If one field is asserted to be incorrect according to the Builder's specifications.
-