Class InterceptorAutoConfiguration
java.lang.Object
org.axonframework.extension.springboot.autoconfig.InterceptorAutoConfiguration
@AutoConfiguration
@AutoConfigureAfter(AxonAutoConfiguration.class)
public class InterceptorAutoConfiguration
extends Object
Interceptor autoconfiguration class for Axon Framework application. Discovers
MessageHandlerInterceptors and
MessageDispatchInterceptor and registers them with the respective buses and gateways.
Note: This class use a hack approach! Because some gateways/buses (or custom interceptors provided by the framework user) need an axonConfiguration to initialize, the usual way of registering interceptors in the ConfigurerModule.onInitialize method does not work for them. This is due to a circular reference caused e.g. by JpaJavaxEventStoreAutoConfiguration. So we register them by injecting gateway/bus components in to the InitializingBean function and register the interceptors there.
- Since:
- 4.11.0
- Author:
- Christian Thiel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondispatchInterceptorEnhancer(Optional<List<MessageDispatchInterceptor<? super CommandMessage>>> commandInterceptors, Optional<List<MessageDispatchInterceptor<? super EventMessage>>> eventInterceptors, Optional<List<MessageDispatchInterceptor<? super QueryMessage>>> queryInterceptors) Bean creation method for aDecoratorDefinitionthat registersMessage-specificMessageDispatchInterceptorswith theDispatchInterceptorRegistry.handlerInterceptorEnhancer(Optional<List<MessageHandlerInterceptor<Message>>> interceptors, Optional<List<MessageHandlerInterceptor<CommandMessage>>> commandInterceptors, Optional<List<MessageHandlerInterceptor<EventMessage>>> eventInterceptors, Optional<List<MessageHandlerInterceptor<QueryMessage>>> queryInterceptors) Bean creation method for aDecoratorDefinitionthat registersMessage-specificMessageHandlerInterceptorswith theHandlerInterceptorRegistry.
-
Constructor Details
-
InterceptorAutoConfiguration
public InterceptorAutoConfiguration()
-
-
Method Details
-
dispatchInterceptorEnhancer
@Bean @ConditionalOnBean(MessageDispatchInterceptor.class) public DecoratorDefinition<DispatchInterceptorRegistry,DispatchInterceptorRegistry> dispatchInterceptorEnhancer(Optional<List<MessageDispatchInterceptor<? super CommandMessage>>> commandInterceptors, Optional<List<MessageDispatchInterceptor<? super EventMessage>>> eventInterceptors, Optional<List<MessageDispatchInterceptor<? super QueryMessage>>> queryInterceptors) Bean creation method for aDecoratorDefinitionthat registersMessage-specificMessageDispatchInterceptorswith theDispatchInterceptorRegistry.- Parameters:
commandInterceptors-CommandMessage-specific and genericMessagedispatch interceptors to register for commands.eventInterceptors-EventMessage-specific and genericMessagedispatch interceptors to register for events.queryInterceptors-QueryMessage-specific and genericMessagedispatch interceptors to register for queries.- Returns:
- A bean creation method for a
DecoratorDefinitionthat registersMessage-specificMessageDispatchInterceptorswith theDispatchInterceptorRegistry.
-
handlerInterceptorEnhancer
@Bean @ConditionalOnBean(MessageHandlerInterceptor.class) public DecoratorDefinition<HandlerInterceptorRegistry,HandlerInterceptorRegistry> handlerInterceptorEnhancer(Optional<List<MessageHandlerInterceptor<Message>>> interceptors, Optional<List<MessageHandlerInterceptor<CommandMessage>>> commandInterceptors, Optional<List<MessageHandlerInterceptor<EventMessage>>> eventInterceptors, Optional<List<MessageHandlerInterceptor<QueryMessage>>> queryInterceptors) Bean creation method for aDecoratorDefinitionthat registersMessage-specificMessageHandlerInterceptorswith theHandlerInterceptorRegistry.- Parameters:
interceptors- GenericMessagehandler interceptors to register.commandInterceptors-CommandMessage-specific handler interceptors to register.eventInterceptors-EventMessage-specific handler interceptors to register.queryInterceptors-QueryMessage-specific handler interceptors to register.- Returns:
- A bean creation method for a
DecoratorDefinitionthat registersMessage-specificMessageHandlerInterceptorswith theDispatchInterceptorRegistry.
-