Class DefaultDispatchInterceptorRegistry
- All Implemented Interfaces:
DescribableComponent,DispatchInterceptorRegistry
DispatchInterceptorRegistry, maintaining lists of CommandMessage,
EventMessage, and QueryMessage-specific
MessageDispatchInterceptors.
This implementation ensures give interceptor builders methods are only invoked once.
Note that this does not apply to given factories!
- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<MessageDispatchInterceptor<? super CommandMessage>> commandInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofCommandMessage-specificMessageDispatchInterceptorsregistered in this registry for a specificcomponentTypeandcomponentName.voiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.List<MessageDispatchInterceptor<? super EventMessage>> eventInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofEventMessage-specificMessageDispatchInterceptorsregistered in this registry for a specificcomponentTypeandcomponentName.List<MessageDispatchInterceptor<? super QueryMessage>> queryInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofQueryMessage-specificMessageDispatchInterceptorsregistered in this registry for a specificcomponentTypeandcomponentName.registerCommandInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super CommandMessage>> interceptorBuilder) registerCommandInterceptor(DispatchInterceptorFactory<? super CommandMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aCommandMessage-specificMessageDispatchInterceptor.registerEventInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super EventMessage>> interceptorBuilder) registerEventInterceptor(DispatchInterceptorFactory<? super EventMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aEventMessage-specificMessageDispatchInterceptor.registerInterceptor(ComponentBuilder<MessageDispatchInterceptor<Message>> interceptorBuilder) registerInterceptor(DispatchInterceptorFactory<Message> interceptorFactory) Registers the given component-awareinterceptorFactoryfor a genericMessageMessageDispatchInterceptor.registerQueryInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super QueryMessage>> interceptorBuilder) registerQueryInterceptor(DispatchInterceptorFactory<? super QueryMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aQueryMessage-specificMessageDispatchInterceptor.registerSubscriptionQueryUpdateInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super SubscriptionQueryUpdateMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptor.registerSubscriptionQueryUpdateInterceptor(DispatchInterceptorFactory<? super SubscriptionQueryUpdateMessage> interceptorFactory) Registers the given component-awareinterceptorFactoryfor aSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptor.subscriptionQueryUpdateInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Returns the list ofSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptorsregistered in this registry for a specificcomponentTypeandcomponentName.
-
Constructor Details
-
DefaultDispatchInterceptorRegistry
public DefaultDispatchInterceptorRegistry()
-
-
Method Details
-
registerInterceptor
public DispatchInterceptorRegistry registerInterceptor(ComponentBuilder<MessageDispatchInterceptor<Message>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor a genericMessageMessageDispatchInterceptor.Registering an interceptor per a
ComponentBuilderensures the interceptor is only built once.- Specified by:
registerInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- the genericMessageMessageDispatchInterceptorbuilder to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerInterceptor
public DispatchInterceptorRegistry registerInterceptor(DispatchInterceptorFactory<Message> interceptorFactory) Description copied from interface:DispatchInterceptorRegistryRegisters the given component-awareinterceptorFactoryfor a genericMessageMessageDispatchInterceptor.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
DispatchInterceptorFactoryenforces 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 useDispatchInterceptorRegistry.registerInterceptor(ComponentBuilder)instead.- Specified by:
registerInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorFactory- the genericMessageMessageDispatchInterceptorfactory to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerCommandInterceptor
public DispatchInterceptorRegistry registerCommandInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super CommandMessage>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor aCommandMessage-specificMessageDispatchInterceptor.Registering an interceptor per a
ComponentBuilderensures the interceptor is only build once.- Specified by:
registerCommandInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- theCommandMessage-specificMessageDispatchInterceptorbuilder to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerCommandInterceptor
public DispatchInterceptorRegistry registerCommandInterceptor(DispatchInterceptorFactory<? super CommandMessage> interceptorFactory) Description copied from interface:DispatchInterceptorRegistryRegisters the given component-awareinterceptorFactoryfor aCommandMessage-specificMessageDispatchInterceptor.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
DispatchInterceptorFactoryenforces 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 useDispatchInterceptorRegistry.registerCommandInterceptor(ComponentBuilder)instead.- Specified by:
registerCommandInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorFactory- theCommandMessage-specificMessageDispatchInterceptorfactory to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerEventInterceptor
public DispatchInterceptorRegistry registerEventInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super EventMessage>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor aEventMessage-specificMessageDispatchInterceptor.Registering an interceptor per a
ComponentBuilderensures the interceptor is only build once.- Specified by:
registerEventInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- theEventMessage-specificMessageDispatchInterceptorbuilder to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerEventInterceptor
public DispatchInterceptorRegistry registerEventInterceptor(DispatchInterceptorFactory<? super EventMessage> interceptorFactory) Description copied from interface:DispatchInterceptorRegistryRegisters the given component-awareinterceptorFactoryfor aEventMessage-specificMessageDispatchInterceptor.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
DispatchInterceptorFactoryenforces 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 useDispatchInterceptorRegistry.registerEventInterceptor(ComponentBuilder)instead.- Specified by:
registerEventInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorFactory- theEventMessage-specificMessageDispatchInterceptorfactory to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerQueryInterceptor
public DispatchInterceptorRegistry registerQueryInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super QueryMessage>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor aQueryMessage-specificMessageDispatchInterceptor.Registering an interceptor per a
ComponentBuilderensures the interceptor is only build once.- Specified by:
registerQueryInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- theQueryMessage-specificMessageDispatchInterceptorbuilder to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerQueryInterceptor
public DispatchInterceptorRegistry registerQueryInterceptor(DispatchInterceptorFactory<? super QueryMessage> interceptorFactory) Description copied from interface:DispatchInterceptorRegistryRegisters the given component-awareinterceptorFactoryfor aQueryMessage-specificMessageDispatchInterceptor.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
DispatchInterceptorFactoryenforces 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 useDispatchInterceptorRegistry.registerQueryInterceptor(ComponentBuilder)instead.- Specified by:
registerQueryInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorFactory- theQueryMessage-specificMessageDispatchInterceptorfactory to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerSubscriptionQueryUpdateInterceptor
public DispatchInterceptorRegistry registerSubscriptionQueryUpdateInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super SubscriptionQueryUpdateMessage>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor aSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptor.Registering an interceptor per a
ComponentBuilderensures the interceptor is only build once.- Specified by:
registerSubscriptionQueryUpdateInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- theSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptorbuilder to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
registerSubscriptionQueryUpdateInterceptor
public DispatchInterceptorRegistry registerSubscriptionQueryUpdateInterceptor(DispatchInterceptorFactory<? super SubscriptionQueryUpdateMessage> interceptorFactory) Description copied from interface:DispatchInterceptorRegistryRegisters the given component-awareinterceptorFactoryfor aSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptor.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
DispatchInterceptorFactoryenforces 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 useDispatchInterceptorRegistry.registerSubscriptionQueryUpdateInterceptor(ComponentBuilder)instead.- Specified by:
registerSubscriptionQueryUpdateInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorFactory- theSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptorfactory to register- Returns:
- this
InterceptorRegistry, for fluent interfacing
-
commandInterceptors
public List<MessageDispatchInterceptor<? super CommandMessage>> commandInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Description copied from interface:DispatchInterceptorRegistryReturns the list ofCommandMessage-specificMessageDispatchInterceptorsregistered in this registry for a specificcomponentTypeandcomponentName.This collection contains generic
MessageMessageDispatchInterceptorsthat have beenregisteredwhen the generic builder returns an instance.- Specified by:
commandInterceptorsin interfaceDispatchInterceptorRegistry- Parameters:
config- the configuration to build allCommandMessage-specificMessageDispatchInterceptorswithcomponentType- the type of the component being interceptedcomponentName- the name of the component being intercepted- Returns:
- the list of
CommandMessage-specificMessageDispatchInterceptors
-
eventInterceptors
public List<MessageDispatchInterceptor<? super EventMessage>> eventInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Description copied from interface:DispatchInterceptorRegistryReturns the list ofEventMessage-specificMessageDispatchInterceptorsregistered in this registry for a specificcomponentTypeandcomponentName.This collection contains generic
MessageMessageDispatchInterceptorsthat have beenregisteredwhen the generic builder returns an instance.- Specified by:
eventInterceptorsin interfaceDispatchInterceptorRegistry- Parameters:
config- the configuration to build allEventMessage-specificMessageDispatchInterceptorswithcomponentType- the type of the component to retrieve a dispatch interceptor forcomponentName- the name of the component to retrieve a dispatch interceptor for- Returns:
- the list of
EventMessage-specificMessageDispatchInterceptors
-
queryInterceptors
public List<MessageDispatchInterceptor<? super QueryMessage>> queryInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Description copied from interface:DispatchInterceptorRegistryReturns the list ofQueryMessage-specificMessageDispatchInterceptorsregistered in this registry for a specificcomponentTypeandcomponentName.This collection contains generic
MessageMessageDispatchInterceptorsthat have beenregisteredwhen the generic builder returns an instance.- Specified by:
queryInterceptorsin interfaceDispatchInterceptorRegistry- Parameters:
config- the configuration to build allQueryMessage-specificMessageDispatchInterceptorswithcomponentType- the type of the component to retrieve a dispatch interceptor forcomponentName- the name of the component to retrieve a dispatch interceptor for- Returns:
- the list of
QueryMessage-specificMessageDispatchInterceptors
-
subscriptionQueryUpdateInterceptors
public List<MessageDispatchInterceptor<? super SubscriptionQueryUpdateMessage>> subscriptionQueryUpdateInterceptors(Configuration config, Class<?> componentType, @Nullable String componentName) Description copied from interface:DispatchInterceptorRegistryReturns the list ofSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptorsregistered in this registry for a specificcomponentTypeandcomponentName.This collection contains generic
MessageMessageDispatchInterceptorsthat have beenregisteredwhen the generic builder returns an instance.- Specified by:
subscriptionQueryUpdateInterceptorsin interfaceDispatchInterceptorRegistry- Parameters:
config- the configuration to build allSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptorswithcomponentType- the type of the component to retrieve a dispatch interceptor forcomponentName- the name of the component to retrieve a dispatch interceptor for- Returns:
- the list of
SubscriptionQueryUpdateMessage-specificMessageDispatchInterceptors
-
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.
-