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>> monitorBuilder) Registers acommandMessageMonitorbuilder for all command-specific infrastructure components component in this configuration.registerCommandMonitor(MessageMonitorFactory<? super CommandMessage> monitorFactory) Registers amessage monitor factoryforcommand-specificinfrastructure components in this configuration.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>> monitorBuilder) Registers aeventMessageMonitorbuilder for all event-specific infrastructure components component in this configuration.registerEventMonitor(MessageMonitorFactory<? super EventMessage> monitorFactory) Registers amessage monitor factoryforevent-specificinfrastructure components in this configuration.registerEventSink(ComponentBuilder<EventSink> eventSinkBuilder) Registers the givenEventSinkfactory in thisConfigurer.registerMessageHandlerInterceptor(ComponentBuilder<MessageHandlerInterceptor<Message>> interceptorBuilder) registerMessageMonitor(ComponentBuilder<MessageMonitor<Message>> monitorBuilder) Registers aMessageMonitorbuilder for any type of messaging component in this configuration.registerMessageMonitor(MessageMonitorFactory<Message> monitorFactory) Registers amessage monitor factoryfor any type of messaging component in this 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>> monitorBuilder) Registers a query monitor using the specifiedmonitorBuilder.registerQueryMonitor(MessageMonitorFactory<? super QueryMessage> monitorFactory) Registers amessage monitor factoryforquery-specificinfrastructure components in this configuration.registerSubscriptionQueryUpdateMonitor(ComponentBuilder<MessageMonitor<? super SubscriptionQueryUpdateMessage>> monitorBuilder) Registers a subscription query update monitor using the specifiedmonitorBuilder.registerSubscriptionQueryUpdateMonitor(MessageMonitorFactory<? super SubscriptionQueryUpdateMessage> monitorFactory) Registers amessage monitor factoryforsubscription-update-specificinfrastructure components in this configuration.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(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
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(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(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(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(ComponentBuilder<MessageDispatchInterceptor<Message>> interceptorBuilder) Registers the given genericMessageMessageDispatchInterceptorbuilder 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(ComponentBuilder<MessageDispatchInterceptor<? super CommandMessage>> interceptorBuilder) Registers the givenCommandMessage-specificMessageDispatchInterceptorbuilder 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(ComponentBuilder<MessageDispatchInterceptor<? super EventMessage>> interceptorBuilder) Registers the givenEventMessage-specificMessageDispatchInterceptorbuilder 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(ComponentBuilder<MessageDispatchInterceptor<? super QueryMessage>> interceptorBuilder) Registers the givenQueryMessage-specificMessageDispatchInterceptorbuilder 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(ComponentBuilder<MessageHandlerInterceptor<Message>> interceptorBuilder) Registers the given genericMessageMessageHandlerInterceptorbuilder 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(ComponentBuilder<MessageHandlerInterceptor<? super CommandMessage>> interceptorBuilder) Registers the givenCommandMessageMessageHandlerInterceptorbuilder 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(ComponentBuilder<MessageHandlerInterceptor<? super EventMessage>> interceptorBuilder) Registers the givenEventMessageMessageHandlerInterceptorbuilder 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(ComponentBuilder<MessageHandlerInterceptor<? super QueryMessage>> interceptorBuilder) Registers the givenQueryMessageMessageHandlerInterceptorbuilder 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
public MessagingConfigurer registerCommandHandlingModule(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
public MessagingConfigurer registerQueryHandlingModule(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(ComponentBuilder<MessageMonitor<Message>> monitorBuilder) Registers aMessageMonitorbuilder for any type of messaging component in this configuration.If more fine-grained control is needed how and when a monitor should be created, use the
registerMessageMonitor(MessageMonitorFactory)operation instead.- Parameters:
monitorBuilder- a builder for creating aMessageMonitorinstance to monitor messages.- Returns:
- the current instance of the
Configurerfor a fluent API
-
registerMessageMonitor
Registers amessage monitor factoryfor any type of messaging component in this configuration.The factory receives the component's type and name for which it is invoked, ensuring unique
MessageMonitorscan be constructed for the component at hand.- Parameters:
monitorFactory- a factory for creating aMessageMonitorinstance to monitor messages- Returns:
- the current instance of the
Configurerfor a fluent API
-
registerCommandMonitor
public MessagingConfigurer registerCommandMonitor(ComponentBuilder<MessageMonitor<? super CommandMessage>> monitorBuilder) Registers acommandMessageMonitorbuilder for all command-specific infrastructure components component in this configuration.If more fine-grained control is needed how and when a monitor should be created, use the
registerCommandMonitor(MessageMonitorFactory)operation instead.- Parameters:
monitorBuilder- a builder for creating acommand-specificMessageMonitorinstance- Returns:
- the current instance of the
Configurerfor a fluent API
-
registerCommandMonitor
public MessagingConfigurer registerCommandMonitor(MessageMonitorFactory<? super CommandMessage> monitorFactory) Registers amessage monitor factoryforcommand-specificinfrastructure components in this configuration.The factory receives the component's type and name for which it is invoked, ensuring unique
MessageMonitorscan be constructed for the component at hand.- Parameters:
monitorFactory- a factory for creating acommand-specificMessageMonitorinstance- Returns:
- the current instance of the
Configurerfor a fluent API
-
registerEventMonitor
public MessagingConfigurer registerEventMonitor(ComponentBuilder<MessageMonitor<? super EventMessage>> monitorBuilder) Registers aeventMessageMonitorbuilder for all event-specific infrastructure components component in this configuration.If more fine-grained control is needed how and when a monitor should be created, use the
registerEventMonitor(MessageMonitorFactory)operation instead.- Parameters:
monitorBuilder- a builder for creating aevent-specificMessageMonitorinstance- Returns:
- the current instance of the
Configurerfor a fluent API
-
registerEventMonitor
public MessagingConfigurer registerEventMonitor(MessageMonitorFactory<? super EventMessage> monitorFactory) Registers amessage monitor factoryforevent-specificinfrastructure components in this configuration.The factory receives the component's type and name for which it is invoked, ensuring unique
MessageMonitorscan be constructed for the component at hand.- Parameters:
monitorFactory- a factory for creating aevent-specificMessageMonitorinstance- Returns:
- the current instance of the
Configurerfor a fluent API
-
registerQueryMonitor
public MessagingConfigurer registerQueryMonitor(ComponentBuilder<MessageMonitor<? super QueryMessage>> monitorBuilder) Registers a query monitor using the specifiedmonitorBuilder.If more fine-grained control is needed how and when a monitor should be created, use the
registerQueryMonitor(MessageMonitorFactory)operation instead.- Parameters:
monitorBuilder- a builder for creating aquery-specificMessageMonitorinstance- Returns:
- the current instance of the
Configurerfor a fluent API
-
registerQueryMonitor
public MessagingConfigurer registerQueryMonitor(MessageMonitorFactory<? super QueryMessage> monitorFactory) Registers amessage monitor factoryforquery-specificinfrastructure components in this configuration.The factory receives the component's type and name for which it is invoked, ensuring unique
MessageMonitorscan be constructed for the component at hand.- Parameters:
monitorFactory- a factory for creating aquery-specificMessageMonitorinstance- Returns:
- the current instance of the
Configurerfor a fluent API
-
registerSubscriptionQueryUpdateMonitor
public MessagingConfigurer registerSubscriptionQueryUpdateMonitor(ComponentBuilder<MessageMonitor<? super SubscriptionQueryUpdateMessage>> monitorBuilder) Registers a subscription query update monitor using the specifiedmonitorBuilder.If more fine-grained control is needed how and when a monitor should be created, use the
registerSubscriptionQueryUpdateMonitor(MessageMonitorFactory)operation instead.- Parameters:
monitorBuilder- a builder for creating asubscription-update-specificMessageMonitorinstance- Returns:
- the current instance of the
Configurerfor a fluent API
-
registerSubscriptionQueryUpdateMonitor
public MessagingConfigurer registerSubscriptionQueryUpdateMonitor(MessageMonitorFactory<? super SubscriptionQueryUpdateMessage> monitorFactory) Registers amessage monitor factoryforsubscription-update-specificinfrastructure components in this configuration.The factory receives the component's type and name for which it is invoked, ensuring unique
MessageMonitorscan be constructed for the component at hand.- Parameters:
monitorFactory- a factory for creating asubscription-update-specificMessageMonitorinstance- Returns:
- the current instance of the
Configurerfor a fluent API
-
componentRegistry
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
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
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.
-