Interface CommandHandlingModule.CommandHandlerPhase
- All Superinterfaces:
ModuleBuilder<CommandHandlingModule>
- Enclosing interface:
CommandHandlingModule
Every registered CommandHandler will be subscribed with the CommandBus of the
ApplicationConfigurer this module is given to.
Provides roughly two options for configuring command handlers. Firstly, a command handler can be registered as
is, through the commandHandler(QualifiedName, CommandHandler) method. Secondly, if the command handler
provides components from the Configuration, a builder of the command handler can
be registered through the commandHandler(QualifiedName, ComponentBuilder) method.
-
Method Summary
Modifier and TypeMethodDescriptionannotatedCommandHandlingComponent(ComponentBuilder<Object> handlingComponentBuilder) Registers the givenhandlingComponentBuilderas anAnnotatedCommandHandlingComponentwithin this module.commandHandler(QualifiedName commandName, ComponentBuilder<CommandHandler> commandHandlerBuilder) Registers the givencommandHandlerBuilderfor the given qualifiedcommandNamewithin this module.commandHandler(QualifiedName commandName, CommandHandler commandHandler) Registers the givencommandHandlerfor the given qualifiedcommandNamewithin this module.commandHandlingComponent(ComponentBuilder<CommandHandlingComponent> handlingComponentBuilder) Registers the givenhandlingComponentBuilderwithin this module.Methods inherited from interface org.axonframework.common.configuration.ModuleBuilder
build
-
Method Details
-
commandHandler
default CommandHandlingModule.CommandHandlerPhase commandHandler(@Nonnull QualifiedName commandName, @Nonnull CommandHandler commandHandler) Registers the givencommandHandlerfor the given qualifiedcommandNamewithin this module.Use this command handler registration method when the command handler in question does not require entities or receives entities through another mechanism. Using a
MessageTypeResolverto derive thecommandNameis beneficial to ensure consistent naming across handler subscriptions.Once this module is finalized, the command handler will be subscribed with the
CommandBusof theApplicationConfigurerthe module is registered on.- Parameters:
commandName- The qualified name of the command the givencommandHandlercan handle.commandHandler- The command handler to register with this module.- Returns:
- The command handler phase of this builder, for a fluent API.
-
commandHandler
CommandHandlingModule.CommandHandlerPhase commandHandler(@Nonnull QualifiedName commandName, @Nonnull ComponentBuilder<CommandHandler> commandHandlerBuilder) Registers the givencommandHandlerBuilderfor the given qualifiedcommandNamewithin this module.Using a
MessageTypeResolverto derive thecommandNameis beneficial to ensure consistent naming across handler subscriptions.Once this module is finalized, the command handler from the
commandHandlerBuilderwill be subscribed with theCommandBusof theApplicationConfigurerthe module is registered on.- Parameters:
commandName- The qualified name of the command theCommandHandlercreated by the givencommandHandlerBuilder.commandHandlerBuilder- A builder of aCommandHandler. Provides theConfigurationto retrieve components from to use during construction of the command handler.- Returns:
- The command handler phase of this builder, for a fluent API.
-
commandHandlingComponent
CommandHandlingModule.CommandHandlerPhase commandHandlingComponent(@Nonnull ComponentBuilder<CommandHandlingComponent> handlingComponentBuilder) Registers the givenhandlingComponentBuilderwithin this module.Use this command handler registration method when the command handling component in question does not require entities or receives entities through another mechanism.
Once this module is finalized, the resulting
CommandHandlingComponentfrom thehandlingComponentBuilderwill be subscribed with theCommandBusof theApplicationConfigurerthe module is registered on.- Parameters:
handlingComponentBuilder- A builder of aCommandHandlingComponent. Provides theConfigurationto retrieve components from to use during construction of the command handling component.- Returns:
- The command handler phase of this builder, for a fluent API.
-
annotatedCommandHandlingComponent
default CommandHandlingModule.CommandHandlerPhase annotatedCommandHandlingComponent(@Nonnull ComponentBuilder<Object> handlingComponentBuilder) Registers the givenhandlingComponentBuilderas anAnnotatedCommandHandlingComponentwithin this module.This will scan the given
handlingComponentBuilderfor methods annotated withCommandHandlerand register them as command handlers for theCommandBusof theApplicationConfigurer.- Parameters:
handlingComponentBuilder- A builder of aCommandHandlingComponent. Provides theConfigurationto retrieve components from to use during construction of the command handling component.- Returns:
- The command handler phase of this builder, for a fluent API.
-