Class MessagingConfigurer
- All Implemented Interfaces:
ApplicationConfigurer
ApplicationConfigurer of Axon Framework's configuration API.
Provides register operations for command,
event, and query
infrastructure components.
This configurer registers several defaults, provided by class MessagingConfigurationDefaults.
To replace
or decorate any of these defaults, use their respective interfaces as the identifier. For example, to adjust the
CommandBus, invoke componentRegistry(Consumer) and
ComponentRegistry.registerComponent(Class, ComponentBuilder) with CommandBus.class to replace it.
MessagingConfigurer.create()
.componentRegistry(cr -> cr.registerEnhancer(CommandBus.class, (config, component) -> ...));
- Since:
- 5.0.0
- Author:
- Allard Buijze, Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns the completely initializedConfigurationinstance of typeCbuilt using thisConfigurerimplementation.componentRegistry(Consumer<ComponentRegistry> componentRegistrar) Executes the givencomponentRegistraron the component registry associated with thisApplicationConfigurer.static MessagingConfigurercreate()Build a defaultMessagingConfigurerinstance with several messaging defaults, as well as methods to register (e.g.) acommand bus.static MessagingConfigurerenhance(ApplicationConfigurer applicationConfigurer) Creates a MessagingConfigurer that enhances an existingApplicationConfigurer.eventProcessing(Consumer<EventProcessingConfigurer> configurerTask) Delegates givenconfigurerTaskto theEventProcessingConfigurer.lifecycleRegistry(Consumer<LifecycleRegistry> lifecycleRegistrar) Executes the givenlifecycleRegistraron the lifecycle registry associated with thisApplicationConfigurer.registerCommandBus(ComponentBuilder<CommandBus> commandBusBuilder) Registers the givenCommandBusfactory in thisConfigurer.registerCommandDispatchInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super CommandMessage>> interceptorBuilder) registerCommandHandlerInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super CommandMessage>> interceptorBuilder) registerCommandHandlingModule(ModuleBuilder<CommandHandlingModule> moduleBuilder) Registers the givenbuilderfor aCommandHandlingModuleto use in this configuration.registerCommandMonitor(ComponentBuilder<MessageMonitor<? super CommandMessage>> messageMonitorBuilder) Registers a command monitor using the given message monitor builder.registerCorrelationDataProvider(ComponentBuilder<CorrelationDataProvider> providerBuilder) Registers the givenCorrelationDataProviderfactory in thisproviderBuilder.registerDispatchInterceptor(ComponentBuilder<MessageDispatchInterceptor<Message>> interceptorBuilder) registerEventDispatchInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super EventMessage>> interceptorBuilder) registerEventHandlerInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super EventMessage>> interceptorBuilder) registerEventMonitor(ComponentBuilder<MessageMonitor<? super EventMessage>> messageMonitorBuilder) Registers a component builder to configure theMessageMonitorused for monitoringEventMessage.registerEventSink(ComponentBuilder<EventSink> eventSinkBuilder) Registers the givenEventSinkfactory in thisConfigurer.registerMessageHandlerInterceptor(ComponentBuilder<MessageHandlerInterceptor<Message>> interceptorBuilder) registerMessageMonitor(ComponentBuilder<MessageMonitor<Message>> messageMonitorBuilder) Registers a message monitor for the messaging components in the configuration.registerMessageTypeResolver(ComponentBuilder<MessageTypeResolver> messageTypeResolverFactory) Registers the givenMessageTypeResolverfactory in thisConfigurer.registerParameterResolverFactory(ComponentBuilder<ParameterResolverFactory> parameterResolverFactoryBuilder) Registers the givenParameterResolverFactoryfactory in thisConfigurer.registerQueryBus(ComponentBuilder<QueryBus> queryBusBuilder) Registers the givenQueryBusfactory in thisConfigurer.registerQueryDispatchInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super QueryMessage>> interceptorBuilder) registerQueryHandlerInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super QueryMessage>> interceptorBuilder) registerQueryHandlingModule(ModuleBuilder<QueryHandlingModule> moduleBuilder) Registers the givenbuilderfor aQueryHandlingModuleto use in this configuration.registerQueryMonitor(ComponentBuilder<MessageMonitor<? super QueryMessage>> messageMonitorBuilder) Registers a query monitor using the specifiedmessageMonitorBuilder.registerSubscriptionQueryUpdateMonitor(ComponentBuilder<MessageMonitor<? super SubscriptionQueryUpdateMessage>> messageMonitorBuilder) Registers a subscription query update monitor using the specifiedmessageMonitorBuilder.registerUnitOfWorkFactory(ComponentBuilder<UnitOfWorkFactory> unitOfWorkFactoryBuilder) Registers the givenUnitOfWorkFactoryfactory in thisConfigurer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.common.configuration.ApplicationConfigurer
start
-
Method Details
-
enhance
Creates a MessagingConfigurer that enhances an existingApplicationConfigurer. This method is useful when applying multiple specialized Configurers to configure a single application.- Parameters:
applicationConfigurer- TheApplicationConfigurerto enhance with configuration of messaging components.- Returns:
- The current instance of the
Configurerfor a fluent API. - See Also:
-
create
Build a defaultMessagingConfigurerinstance with several messaging defaults, as well as methods to register (e.g.) acommand bus.Besides the specific operations, the
MessagingConfigurerallows for configuring genericcomponents,component decorators,enhancers, andmodulesfor a message-driven application.- Returns:
- A
MessagingConfigurerinstance for further configuring. - See Also:
-
registerMessageTypeResolver
public MessagingConfigurer registerMessageTypeResolver(@Nonnull ComponentBuilder<MessageTypeResolver> messageTypeResolverFactory) Registers the givenMessageTypeResolverfactory in thisConfigurer. This is the globalMessageTypeResolver, whose mappings can be accessed by all Modules and Components within the application.The
commandBusFactoryreceives theConfigurationas input and is expected to return aMessageTypeResolverinstance.- Parameters:
messageTypeResolverFactory- The factory building theMessageTypeResolver.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
registerCommandBus
public MessagingConfigurer registerCommandBus(@Nonnull ComponentBuilder<CommandBus> commandBusBuilder) Registers the givenCommandBusfactory in thisConfigurer.The
commandBusBuilderreceives theConfigurationas input and is expected to return aCommandBusinstance.- Parameters:
commandBusBuilder- The builder constructing theCommandBus.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
registerEventSink
Registers the givenEventSinkfactory in thisConfigurer.The
eventSinkBuilderreceives theConfigurationas input and is expected to return aEventSinkinstance.- Parameters:
eventSinkBuilder- The builder constructing theEventSink.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
registerQueryBus
Registers the givenQueryBusfactory in thisConfigurer.The
queryBusBuilderreceives theConfigurationas input and is expected to return aQueryBusinstance.- Parameters:
queryBusBuilder- The builder constructing theQueryBus.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
registerParameterResolverFactory
public MessagingConfigurer registerParameterResolverFactory(@Nonnull ComponentBuilder<ParameterResolverFactory> parameterResolverFactoryBuilder) Registers the givenParameterResolverFactoryfactory in thisConfigurer.The
parameterResolverFactoryBuilderreceives theConfigurationas input and is expected to return aParameterResolverFactoryinstance.- Parameters:
parameterResolverFactoryBuilder- The builder constructing theParameterResolverFactory.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
registerUnitOfWorkFactory
public MessagingConfigurer registerUnitOfWorkFactory(@Nonnull ComponentBuilder<UnitOfWorkFactory> unitOfWorkFactoryBuilder) Registers the givenUnitOfWorkFactoryfactory in thisConfigurer.The
unitOfWorkFactoryBuilderreceives theConfigurationas input and is expected to return aUnitOfWorkFactoryinstance.- Parameters:
unitOfWorkFactoryBuilder- The builder constructing theUnitOfWorkFactory.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
registerCorrelationDataProvider
public MessagingConfigurer registerCorrelationDataProvider(@Nonnull ComponentBuilder<CorrelationDataProvider> providerBuilder) Registers the givenCorrelationDataProviderfactory in thisproviderBuilder.The
interceptorBuilderreceives theConfigurationas input and is expected to return aCorrelationDataProviderinstance.CorrelationDataProvidersare typically automatically registered with all applicable infrastructure components through theCorrelationDataProviderRegistry.- Parameters:
providerBuilder- The builder constructing theCorrelationDataProvider.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerDispatchInterceptor
public MessagingConfigurer registerDispatchInterceptor(@Nonnull ComponentBuilder<MessageDispatchInterceptor<Message>> interceptorBuilder) Registers the given genericMessageMessageDispatchInterceptorfactory in thisConfigurer.The
interceptorBuilderreceives theConfigurationas input and is expected to return a genericMessageMessageDispatchInterceptorinstance.Generic
MessageDispatchInterceptorsare typically automatically registered with all applicable infrastructure components through theDispatchInterceptorRegistry.- Parameters:
interceptorBuilder- The builder constructing the genericMessageMessageDispatchInterceptor.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerCommandDispatchInterceptor
public MessagingConfigurer registerCommandDispatchInterceptor(@Nonnull ComponentBuilder<MessageDispatchInterceptor<? super CommandMessage>> interceptorBuilder) Registers the givenCommandMessage-specificMessageDispatchInterceptorfactory in thisConfigurer.The
interceptorBuilderreceives theConfigurationas input and is expected to return aCommandMessage-specificMessageDispatchInterceptorinstance.CommandMessageMessageDispatchInterceptorsare typically automatically registered with all applicable infrastructure components through theDispatchInterceptorRegistry.- Parameters:
interceptorBuilder- The builder constructing theCommandMessage-specificMessageDispatchInterceptor.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerEventDispatchInterceptor
public MessagingConfigurer registerEventDispatchInterceptor(@Nonnull ComponentBuilder<MessageDispatchInterceptor<? super EventMessage>> interceptorBuilder) Registers the givenEventMessage-specificMessageDispatchInterceptorfactory in thisConfigurer.The
interceptorBuilderreceives theConfigurationas input and is expected to return aEventMessage-specificMessageDispatchInterceptorinstance.EventMessage-specificMessageDispatchInterceptorsare typically automatically registered with all applicable infrastructure components through theDispatchInterceptorRegistry.- Parameters:
interceptorBuilder- The builder constructing theEventMessage-specificMessageDispatchInterceptor.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerQueryDispatchInterceptor
public MessagingConfigurer registerQueryDispatchInterceptor(@Nonnull ComponentBuilder<MessageDispatchInterceptor<? super QueryMessage>> interceptorBuilder) Registers the givenQueryMessage-specificMessageDispatchInterceptorfactory in thisConfigurer.The
interceptorBuilderreceives theConfigurationas input and is expected to return aQueryMessage-specificMessageDispatchInterceptorinstance.QueryMessage-specificMessageDispatchInterceptorsare typically automatically registered with all applicable infrastructure components through theDispatchInterceptorRegistry.- Parameters:
interceptorBuilder- The builder constructing theQueryMessage-specificMessageDispatchInterceptor.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerMessageHandlerInterceptor
public MessagingConfigurer registerMessageHandlerInterceptor(@Nonnull ComponentBuilder<MessageHandlerInterceptor<Message>> interceptorBuilder) Registers the given genericMessageMessageHandlerInterceptorfactory in thisConfigurer.The
interceptorBuilderreceives theConfigurationas input and is expected to return a genericMessageMessageHandlerInterceptorinstance.Generic
MessageHandlerInterceptorsare typically automatically registered with all applicable infrastructure components through theHandlerInterceptorRegistry.- Parameters:
interceptorBuilder- The builder constructing the genericMessageMessageHandlerInterceptor.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerCommandHandlerInterceptor
public MessagingConfigurer registerCommandHandlerInterceptor(@Nonnull ComponentBuilder<MessageHandlerInterceptor<? super CommandMessage>> interceptorBuilder) Registers the givenCommandMessageMessageHandlerInterceptorfactory in thisConfigurer.The
interceptorBuilderreceives theConfigurationas input and is expected to return aCommandMessageMessageHandlerInterceptorinstance.CommandMessageMessageHandlerInterceptorsare typically automatically registered with all applicable infrastructure components through theHandlerInterceptorRegistry.- Parameters:
interceptorBuilder- The builder constructing theCommandMessageMessageHandlerInterceptor.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerEventHandlerInterceptor
public MessagingConfigurer registerEventHandlerInterceptor(@Nonnull ComponentBuilder<MessageHandlerInterceptor<? super EventMessage>> interceptorBuilder) Registers the givenEventMessageMessageHandlerInterceptorfactory in thisConfigurer.The
interceptorBuilderreceives theConfigurationas input and is expected to return aEventMessageMessageHandlerInterceptorinstance.EventMessageMessageHandlerInterceptorsare typically automatically registered with all applicable infrastructure components through theHandlerInterceptorRegistry.- Parameters:
interceptorBuilder- The builder constructing theEventMessageMessageHandlerInterceptor.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerQueryHandlerInterceptor
public MessagingConfigurer registerQueryHandlerInterceptor(@Nonnull ComponentBuilder<MessageHandlerInterceptor<? super QueryMessage>> interceptorBuilder) Registers the givenQueryMessageMessageHandlerInterceptorfactory in thisConfigurer.The
interceptorBuilderreceives theConfigurationas input and is expected to return aQueryMessageMessageHandlerInterceptorinstance.QueryMessageMessageHandlerInterceptorsare typically automatically registered with all applicable infrastructure components through theHandlerInterceptorRegistry.- Parameters:
interceptorBuilder- The builder constructing theQueryMessageMessageHandlerInterceptor.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerCommandHandlingModule
@Nonnull public MessagingConfigurer registerCommandHandlingModule(@Nonnull ModuleBuilder<CommandHandlingModule> moduleBuilder) Registers the givenbuilderfor aCommandHandlingModuleto use in this configuration.As a
Moduleimplementation, any components registered with the result of the givenmoduleBuilderwill not be accessible from otherModulesto enforce encapsulation. The sole exception to this, areModulesregistered with the resultingCommandHandlingModuleitself.- Parameters:
moduleBuilder- The builder returning a command handling module to register withthis MessagingConfigurer.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerQueryHandlingModule
@Nonnull public MessagingConfigurer registerQueryHandlingModule(@Nonnull ModuleBuilder<QueryHandlingModule> moduleBuilder) Registers the givenbuilderfor aQueryHandlingModuleto use in this configuration.As a
Moduleimplementation, any components registered with the result of the givenmoduleBuilderwill not be accessible from otherModulesto enforce encapsulation. The sole exception to this, areModulesregistered with the resultingQueryHandlingModuleitself.- Parameters:
moduleBuilder- The builder returning a query handling module to register withthis MessagingConfigurer.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerMessageMonitor
public MessagingConfigurer registerMessageMonitor(@Nonnull ComponentBuilder<MessageMonitor<Message>> messageMonitorBuilder) Registers a message monitor for the messaging components in the configuration. MultipleMessageMonitors are possible viaMessageMonitorRegistry.- Parameters:
messageMonitorBuilder- A builder for creating aMessageMonitorinstance to monitor messages.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerCommandMonitor
public MessagingConfigurer registerCommandMonitor(@Nonnull ComponentBuilder<MessageMonitor<? super CommandMessage>> messageMonitorBuilder) Registers a command monitor using the given message monitor builder. This method allows customization of the monitoring logic for command messages by providing a component builder that creates a message monitor for commands.- Parameters:
messageMonitorBuilder- the builder for creating a message monitor to monitor command messages; it must not be null- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerEventMonitor
public MessagingConfigurer registerEventMonitor(@Nonnull ComponentBuilder<MessageMonitor<? super EventMessage>> messageMonitorBuilder) Registers a component builder to configure theMessageMonitorused for monitoringEventMessage.- Parameters:
messageMonitorBuilder- theComponentBuilderfor constructing theMessageMonitorto be registered for monitoring EventMessages.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerQueryMonitor
public MessagingConfigurer registerQueryMonitor(@Nonnull ComponentBuilder<MessageMonitor<? super QueryMessage>> messageMonitorBuilder) Registers a query monitor using the specifiedmessageMonitorBuilder.- Parameters:
messageMonitorBuilder- The builder for aMessageMonitorspecifically designed to monitorQueryMessagemessages.- Returns:
- The current instance of the
Configurerfor a fluent API
-
registerSubscriptionQueryUpdateMonitor
public MessagingConfigurer registerSubscriptionQueryUpdateMonitor(@Nonnull ComponentBuilder<MessageMonitor<? super SubscriptionQueryUpdateMessage>> messageMonitorBuilder) Registers a subscription query update monitor using the specifiedmessageMonitorBuilder.- Parameters:
messageMonitorBuilder- The builder for aMessageMonitorspecifically designed to monitorSubscriptionQueryUpdateMessagemessages.- Returns:
- The current instance of the
Configurerfor a fluent API
-
componentRegistry
public MessagingConfigurer componentRegistry(@Nonnull Consumer<ComponentRegistry> componentRegistrar) Description copied from interface:ApplicationConfigurerExecutes the givencomponentRegistraron the component registry associated with thisApplicationConfigurer.- Specified by:
componentRegistryin interfaceApplicationConfigurer- Parameters:
componentRegistrar- The actions to take on the component registry.- Returns:
- This
ApplicationConfigurerfor a fluent API.
-
lifecycleRegistry
public MessagingConfigurer lifecycleRegistry(@Nonnull Consumer<LifecycleRegistry> lifecycleRegistrar) Description copied from interface:ApplicationConfigurerExecutes the givenlifecycleRegistraron the lifecycle registry associated with thisApplicationConfigurer.- Specified by:
lifecycleRegistryin interfaceApplicationConfigurer- Parameters:
lifecycleRegistrar- The actions to take on the lifecycle registry.- Returns:
- This
ApplicationConfigurerfor a fluent API.
-
eventProcessing
public MessagingConfigurer eventProcessing(@Nonnull Consumer<EventProcessingConfigurer> configurerTask) Delegates givenconfigurerTaskto theEventProcessingConfigurer.Use this operation to configure defaults and register
EventProcessors.- Parameters:
configurerTask- Lambda consuming theEventProcessingConfigurer.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
build
Description copied from interface:ApplicationConfigurerReturns the completely initializedConfigurationinstance of typeCbuilt using thisConfigurerimplementation.It is not recommended to change any configuration on
this ApplicationConfigureronce this method is called.- Specified by:
buildin interfaceApplicationConfigurer- Returns:
- The fully initialized
Configurationinstance of typeC.
-