Class DefaultReactorDispatchInterceptorRegistry
- All Implemented Interfaces:
DescribableComponent,ReactorDispatchInterceptorRegistry
ReactorDispatchInterceptorRegistry, maintaining lists of
CommandMessage, EventMessage, and QueryMessage-specific
ReactorMessageDispatchInterceptors.
This implementation ensures given interceptor builders methods are only invoked once.
Note that this does not apply to given factories!
- Since:
- 5.1.0
- Author:
- Theo Emanuelsson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncommandInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofReactorMessageDispatchInterceptorsregistered forCommandMessagesfor a specificcomponentTypeandcomponentName.voiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.eventInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofReactorMessageDispatchInterceptorsregistered forEventMessagesfor a specificcomponentTypeandcomponentName.queryInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofReactorMessageDispatchInterceptorsregistered forQueryMessagesfor a specificcomponentTypeandcomponentName.registerCommandInterceptor(ComponentBuilder<ReactorMessageDispatchInterceptor<? super CommandMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aCommandMessage-specificReactorMessageDispatchInterceptor.registerCommandInterceptor(ReactorDispatchInterceptorFactory<? super CommandMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aCommandMessage-specificReactorMessageDispatchInterceptor.registerEventInterceptor(ComponentBuilder<ReactorMessageDispatchInterceptor<? super EventMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor anEventMessage-specificReactorMessageDispatchInterceptor.registerEventInterceptor(ReactorDispatchInterceptorFactory<? super EventMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor anEventMessage-specificReactorMessageDispatchInterceptor.registerInterceptor(ComponentBuilder<ReactorMessageDispatchInterceptor<Message>> interceptorBuilder) registerInterceptor(ReactorDispatchInterceptorFactory<Message> interceptorFactory) Registers the given component-awareinterceptorFactoryfor a genericMessageReactorMessageDispatchInterceptor.registerQueryInterceptor(ComponentBuilder<ReactorMessageDispatchInterceptor<? super QueryMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aQueryMessage-specificReactorMessageDispatchInterceptor.registerQueryInterceptor(ReactorDispatchInterceptorFactory<? super QueryMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aQueryMessage-specificReactorMessageDispatchInterceptor.
-
Constructor Details
-
DefaultReactorDispatchInterceptorRegistry
public DefaultReactorDispatchInterceptorRegistry()
-
-
Method Details
-
registerInterceptor
public ReactorDispatchInterceptorRegistry registerInterceptor(ComponentBuilder<ReactorMessageDispatchInterceptor<Message>> interceptorBuilder) Description copied from interface:ReactorDispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor a genericMessageReactorMessageDispatchInterceptor.Registering an interceptor per a
ComponentBuilderensures the interceptor is only built once.- Specified by:
registerInterceptorin interfaceReactorDispatchInterceptorRegistry- Parameters:
interceptorBuilder- the genericMessageReactorMessageDispatchInterceptorbuilder to register- Returns:
- this registry, for fluent interfacing
-
registerInterceptor
public ReactorDispatchInterceptorRegistry registerInterceptor(ReactorDispatchInterceptorFactory<Message> interceptorFactory) Description copied from interface:ReactorDispatchInterceptorRegistryRegisters the given component-awareinterceptorFactoryfor a genericMessageReactorMessageDispatchInterceptor.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
ReactorDispatchInterceptorFactoryenforces 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 useReactorDispatchInterceptorRegistry.registerInterceptor(ComponentBuilder)instead.- Specified by:
registerInterceptorin interfaceReactorDispatchInterceptorRegistry- Parameters:
interceptorFactory- the genericMessageReactorMessageDispatchInterceptorfactory to register- Returns:
- this registry, for fluent interfacing
-
registerCommandInterceptor
public ReactorDispatchInterceptorRegistry registerCommandInterceptor(ComponentBuilder<ReactorMessageDispatchInterceptor<? super CommandMessage>> interceptorBuilder) Description copied from interface:ReactorDispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor aCommandMessage-specificReactorMessageDispatchInterceptor.Registering an interceptor per a
ComponentBuilderensures the interceptor is only built once.- Specified by:
registerCommandInterceptorin interfaceReactorDispatchInterceptorRegistry- Parameters:
interceptorBuilder- theCommandMessage-specificReactorMessageDispatchInterceptorbuilder to register- Returns:
- this registry, for fluent interfacing
-
registerCommandInterceptor
public ReactorDispatchInterceptorRegistry registerCommandInterceptor(ReactorDispatchInterceptorFactory<? super CommandMessage> interceptorFactory) Description copied from interface:ReactorDispatchInterceptorRegistryRegisters the given component-awareinterceptorFactoryfor aCommandMessage-specificReactorMessageDispatchInterceptor.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
ReactorDispatchInterceptorFactoryenforces 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 useReactorDispatchInterceptorRegistry.registerCommandInterceptor(ComponentBuilder)instead.- Specified by:
registerCommandInterceptorin interfaceReactorDispatchInterceptorRegistry- Parameters:
interceptorFactory- theCommandMessage-specificReactorMessageDispatchInterceptorfactory to register- Returns:
- this registry, for fluent interfacing
-
registerEventInterceptor
public ReactorDispatchInterceptorRegistry registerEventInterceptor(ComponentBuilder<ReactorMessageDispatchInterceptor<? super EventMessage>> interceptorBuilder) Description copied from interface:ReactorDispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor anEventMessage-specificReactorMessageDispatchInterceptor.Registering an interceptor per a
ComponentBuilderensures the interceptor is only built once.- Specified by:
registerEventInterceptorin interfaceReactorDispatchInterceptorRegistry- Parameters:
interceptorBuilder- theEventMessage-specificReactorMessageDispatchInterceptorbuilder to register- Returns:
- this registry, for fluent interfacing
-
registerEventInterceptor
public ReactorDispatchInterceptorRegistry registerEventInterceptor(ReactorDispatchInterceptorFactory<? super EventMessage> interceptorFactory) Description copied from interface:ReactorDispatchInterceptorRegistryRegisters the given component-awareinterceptorFactoryfor anEventMessage-specificReactorMessageDispatchInterceptor.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
ReactorDispatchInterceptorFactoryenforces 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 useReactorDispatchInterceptorRegistry.registerEventInterceptor(ComponentBuilder)instead.- Specified by:
registerEventInterceptorin interfaceReactorDispatchInterceptorRegistry- Parameters:
interceptorFactory- theEventMessage-specificReactorMessageDispatchInterceptorfactory to register- Returns:
- this registry, for fluent interfacing
-
registerQueryInterceptor
public ReactorDispatchInterceptorRegistry registerQueryInterceptor(ComponentBuilder<ReactorMessageDispatchInterceptor<? super QueryMessage>> interceptorBuilder) Description copied from interface:ReactorDispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor aQueryMessage-specificReactorMessageDispatchInterceptor.Registering an interceptor per a
ComponentBuilderensures the interceptor is only built once.- Specified by:
registerQueryInterceptorin interfaceReactorDispatchInterceptorRegistry- Parameters:
interceptorBuilder- theQueryMessage-specificReactorMessageDispatchInterceptorbuilder to register- Returns:
- this registry, for fluent interfacing
-
registerQueryInterceptor
public ReactorDispatchInterceptorRegistry registerQueryInterceptor(ReactorDispatchInterceptorFactory<? super QueryMessage> interceptorFactory) Description copied from interface:ReactorDispatchInterceptorRegistryRegisters the given component-awareinterceptorFactoryfor aQueryMessage-specificReactorMessageDispatchInterceptor.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
ReactorDispatchInterceptorFactoryenforces 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 useReactorDispatchInterceptorRegistry.registerQueryInterceptor(ComponentBuilder)instead.- Specified by:
registerQueryInterceptorin interfaceReactorDispatchInterceptorRegistry- Parameters:
interceptorFactory- theQueryMessage-specificReactorMessageDispatchInterceptorfactory to register- Returns:
- this registry, for fluent interfacing
-
commandInterceptors
public List<ReactorMessageDispatchInterceptor<? super CommandMessage>> commandInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Description copied from interface:ReactorDispatchInterceptorRegistryReturns the list ofReactorMessageDispatchInterceptorsregistered forCommandMessagesfor a specificcomponentTypeandcomponentName.- Specified by:
commandInterceptorsin interfaceReactorDispatchInterceptorRegistry- Parameters:
config- the configuration to build allCommandMessage-specificReactorMessageDispatchInterceptorswithcomponentType- the type of the component being interceptedcomponentName- the name of the component being intercepted- Returns:
- the list of command dispatch interceptors
-
eventInterceptors
public List<ReactorMessageDispatchInterceptor<? super EventMessage>> eventInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Description copied from interface:ReactorDispatchInterceptorRegistryReturns the list ofReactorMessageDispatchInterceptorsregistered forEventMessagesfor a specificcomponentTypeandcomponentName.- Specified by:
eventInterceptorsin interfaceReactorDispatchInterceptorRegistry- Parameters:
config- the configuration to build allEventMessage-specificReactorMessageDispatchInterceptorswithcomponentType- the type of the component being interceptedcomponentName- the name of the component being intercepted- Returns:
- the list of event dispatch interceptors
-
queryInterceptors
public List<ReactorMessageDispatchInterceptor<? super QueryMessage>> queryInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Description copied from interface:ReactorDispatchInterceptorRegistryReturns the list ofReactorMessageDispatchInterceptorsregistered forQueryMessagesfor a specificcomponentTypeandcomponentName.- Specified by:
queryInterceptorsin interfaceReactorDispatchInterceptorRegistry- Parameters:
config- the configuration to build allQueryMessage-specificReactorMessageDispatchInterceptorswithcomponentType- the type of the component being interceptedcomponentName- the name of the component being intercepted- Returns:
- the list of query dispatch interceptors
-
describeTo
Description copied from interface:DescribableComponentDescribe the properties ofthis DescribableComponentwith the givendescriptor.Components should call the appropriate
describePropertymethods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.Best Practices: As a general rule, all relevant fields of a
DescribableComponentimplementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing thedescribeTomethod, who should focus on providing information that is useful for understanding the component's configuration and state.Example implementation:
public void describeTo(ComponentDescriptor descriptor) { descriptor.describeProperty("name", this.name); descriptor.describeProperty("enabled", this.enabled); descriptor.describeProperty("configuration", this.configuration); // A nested component descriptor.describeProperty("handlers", this.eventHandlers); // A collection }- Specified by:
describeToin interfaceDescribableComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-