Interface HandlerInterceptorRegistry
- All Superinterfaces:
DescribableComponent
- All Known Implementing Classes:
DefaultHandlerInterceptorRegistry
MessageHandlerInterceptors, acting as a collection of
registered MessageHandlerInterceptors components.
Provides operations to register generic Message, CommandMessage-specific,
EventMessage-specific, or QueryMessage-specific MessageHandlerInterceptors. Registered type
specific MessageHandlerInterceptors can be retrieved through
commandInterceptors(Configuration, Class, String), eventInterceptors(Configuration, Class, String),
and queryInterceptors(Configuration, Class, String).
These operations are expected to be invoked within a
DecoratorDefinition. As such, any registered interceptors are
only applied when the infrastructure component requiring them is constructed. When, for example, an
InterceptingCommandBus is constructed, this registry is invoked to retrieve interceptors. Interceptors that
are registered once the InterceptingCommandBus has already been constructed are not taken into account.
- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionList<MessageHandlerInterceptor<? super CommandMessage>> commandInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofCommandMessage-specificMessageHandlerInterceptorsregistered in this registry for acomponentTypeandcomponentName.List<MessageHandlerInterceptor<? super EventMessage>> eventInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofEventMessage-specificMessageHandlerInterceptorsregistered in this registry for acomponentTypeandcomponentName.List<MessageHandlerInterceptor<? super QueryMessage>> queryInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofQueryMessage-specificMessageHandlerInterceptorsregistered in this registry for acomponentTypeandcomponentName.registerCommandInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super CommandMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aCommandMessageMessageHandlerInterceptorfor all command handling infrastructure components.registerCommandInterceptor(HandlerInterceptorFactory<? super CommandMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aCommandMessageMessageHandlerInterceptorfor all command handling infrastructure components.registerEventInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super EventMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aEventMessageMessageHandlerInterceptorfor all event handling infrastructure components.registerEventInterceptor(HandlerInterceptorFactory<? super EventMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aEventMessageMessageHandlerInterceptorfor all event handling infrastructure components.registerInterceptor(ComponentBuilder<MessageHandlerInterceptor<Message>> interceptorBuilder) Registers the giveninterceptorBuilderconstructing a genericMessageMessageHandlerInterceptorfor all handling infrastructure components.registerInterceptor(HandlerInterceptorFactory<Message> interceptorFactory) Registers the given component-awareinterceptorFactoryconstructing a genericMessageMessageHandlerInterceptorfor all handling infrastructure components.registerQueryInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super QueryMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aQueryMessageMessageHandlerInterceptorfor all query handling infrastructure componentsregisterQueryInterceptor(HandlerInterceptorFactory<? super QueryMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aQueryMessageMessageHandlerInterceptorfor all query handling infrastructure components.Methods inherited from interface org.axonframework.common.infra.DescribableComponent
describeTo
-
Method Details
-
registerInterceptor
HandlerInterceptorRegistry registerInterceptor(ComponentBuilder<MessageHandlerInterceptor<Message>> interceptorBuilder) Registers the giveninterceptorBuilderconstructing a genericMessageMessageHandlerInterceptorfor all handling infrastructure components.Registering an interceptor per a
ComponentBuilderensures the interceptor is only build once.- Parameters:
interceptorBuilder- the genericMessageMessageHandlerInterceptorbuilder to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerInterceptor
HandlerInterceptorRegistry registerInterceptor(HandlerInterceptorFactory<Message> interceptorFactory) Registers the given component-awareinterceptorFactoryconstructing a genericMessageMessageHandlerInterceptorfor all handling infrastructure components.The factory will receive the component type and name when the interceptor is retrieved allowing for component-specific customization of the interceptor. Registering an interceptor per a
HandlerInterceptorFactoryenforces construction of the interceptor for every invocation of the factory, ensuring uniqueness per given type and name. If the interceptor will be identical regardless of the given type or name, please useregisterInterceptor(ComponentBuilder)instead.- Parameters:
interceptorFactory- the genericMessageMessageHandlerInterceptorfactory to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerCommandInterceptor
HandlerInterceptorRegistry registerCommandInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super CommandMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aCommandMessageMessageHandlerInterceptorfor all command handling infrastructure components.Registering an interceptor per a
ComponentBuilderensures the interceptor is only built once.- Parameters:
interceptorBuilder- theCommandMessage-specificMessageHandlerInterceptorbuilder to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerCommandInterceptor
HandlerInterceptorRegistry registerCommandInterceptor(HandlerInterceptorFactory<? super CommandMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aCommandMessageMessageHandlerInterceptorfor all command handling infrastructure components.The factory will receive the component type and name when the interceptor is retrieved allowing for component-specific customization of the interceptor. Registering an interceptor per a
HandlerInterceptorFactoryenforces construction of the interceptor for every invocation of the factory, ensuring uniqueness per given typa and name. If the interceptor will be identical regardless of the given type or name, please useregisterCommandInterceptor(ComponentBuilder)instead.- Parameters:
interceptorFactory- theCommandMessage-specificMessageHandlerInterceptorfactory to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerEventInterceptor
HandlerInterceptorRegistry registerEventInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super EventMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aEventMessageMessageHandlerInterceptorfor all event handling infrastructure components.Registering an interceptor per a
ComponentBuilderensures the interceptor is only build once.- Parameters:
interceptorBuilder- theEventMessage-specificMessageHandlerInterceptorbuilder to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerEventInterceptor
HandlerInterceptorRegistry registerEventInterceptor(HandlerInterceptorFactory<? super EventMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aEventMessageMessageHandlerInterceptorfor all event handling infrastructure components.The factory will receive the component type and name when the interceptor is retrieved allowing for component-specific customization of the interceptor. Registering an interceptor per a
HandlerInterceptorFactoryenforces construction of the interceptor for every invocation of the factory, ensuring uniqueness per given typa and name. If the interceptor will be identical regardless of the given type or name, please useregisterEventInterceptor(ComponentBuilder)instead.- Parameters:
interceptorFactory- theEventMessage-specificMessageHandlerInterceptorfactory to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerQueryInterceptor
HandlerInterceptorRegistry registerQueryInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super QueryMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aQueryMessageMessageHandlerInterceptorfor all query handling infrastructure componentsRegistering an interceptor per a
ComponentBuilderensures the interceptor is only build once.- Parameters:
interceptorBuilder- theQueryMessage-specificMessageHandlerInterceptorbuilder to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerQueryInterceptor
HandlerInterceptorRegistry registerQueryInterceptor(HandlerInterceptorFactory<? super QueryMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aQueryMessageMessageHandlerInterceptorfor all query handling infrastructure components.The factory will receive the component type and name when the interceptor is retrieved allowing for component-specific customization of the interceptor. Registering an interceptor per a
HandlerInterceptorFactoryenforces construction of the interceptor for every invocation of the factory, ensuring uniqueness per given typa and name. If the interceptor will be identical regardless of the given type or name, please useregisterQueryInterceptor(ComponentBuilder)instead.- Parameters:
interceptorFactory- theQueryMessage-specificMessageHandlerInterceptorfactory to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
commandInterceptors
List<MessageHandlerInterceptor<? super CommandMessage>> commandInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofCommandMessage-specificMessageHandlerInterceptorsregistered in this registry for acomponentTypeandcomponentName.This collection contains generic
MessageMessageHandlerInterceptorsthat have beenregisteredwhen the generic builder returns an instance.- Parameters:
config- the configuration to build allCommandMessage-specificMessageHandlerInterceptorswithcomponentType- the type of the component being intercepted to retrieve a handler interceptor forcomponentName- the name of the component being intercepted to retrieve a handler interceptor for- Returns:
- the list of
CommandMessage-specificMessageHandlerInterceptors
-
eventInterceptors
List<MessageHandlerInterceptor<? super EventMessage>> eventInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofEventMessage-specificMessageHandlerInterceptorsregistered in this registry for acomponentTypeandcomponentName.This collection contains generic
MessageMessageHandlerInterceptorsthat have beenregisteredwhen the generic builder returns an instance.- Parameters:
config- the configuration to build allEventMessage-specificMessageHandlerInterceptorswithcomponentType- the type of the component being intercepted to retrieve a handler interceptor forcomponentName- the name of the component being intercepted to retrieve a handler interceptor for- Returns:
- the list of
EventMessage-specificMessageHandlerInterceptors
-
queryInterceptors
List<MessageHandlerInterceptor<? super QueryMessage>> queryInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofQueryMessage-specificMessageHandlerInterceptorsregistered in this registry for acomponentTypeandcomponentName.This collection contains generic
MessageMessageHandlerInterceptorsthat have beenregisteredwhen the generic builder returns an instance.- Parameters:
config- the configuration to build allQueryMessage-specificMessageHandlerInterceptorswithcomponentType- the type of the component being intercepted to retrieve a handler interceptor forcomponentName- the name of the component being intercepted to retrieve a handler interceptor for- Returns:
- the list of
QueryMessage-specificMessageHandlerInterceptors
-