Class DefaultDispatchInterceptorRegistry
- All Implemented Interfaces:
DescribableComponent,DispatchInterceptorRegistry
DispatchInterceptorRegistry, maintaining lists of CommandMessage,
EventMessage, and QueryMessage-specific
MessageDispatchInterceptors.
This implementation ensures give interceptor factory methods are only invoked once.
- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<MessageDispatchInterceptor<? super CommandMessage>> commandInterceptors(Configuration config) Returns the list ofMessageDispatchInterceptorsregistered in this registry.voiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.List<MessageDispatchInterceptor<? super EventMessage>> eventInterceptors(Configuration config) Returns the list ofEventMessage-specificMessageDispatchInterceptorsregistered in this registry.List<MessageDispatchInterceptor<? super QueryMessage>> queryInterceptors(Configuration config) Returns the list ofQueryMessage-specificMessageDispatchInterceptorsregistered in this registry.registerCommandInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super CommandMessage>> interceptorBuilder) registerEventInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super EventMessage>> interceptorBuilder) registerInterceptor(ComponentBuilder<MessageDispatchInterceptor<Message>> interceptorBuilder) registerQueryInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super QueryMessage>> interceptorBuilder) registerSubscriptionQueryUpdateInterceptor(ComponentBuilder<MessageDispatchInterceptor<? super SubscriptionQueryUpdateMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptor.Returns the list ofSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptorsregistered in this registry.
-
Constructor Details
-
DefaultDispatchInterceptorRegistry
public DefaultDispatchInterceptorRegistry()
-
-
Method Details
-
registerInterceptor
@Nonnull public DispatchInterceptorRegistry registerInterceptor(@Nonnull ComponentBuilder<MessageDispatchInterceptor<Message>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistry- Specified by:
registerInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- The genericMessageMessageDispatchInterceptorbuilder to register.- Returns:
- This
InterceptorRegistry, for fluent interfacing.
-
registerCommandInterceptor
@Nonnull public DispatchInterceptorRegistry registerCommandInterceptor(@Nonnull ComponentBuilder<MessageDispatchInterceptor<? super CommandMessage>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistry- Specified by:
registerCommandInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- TheCommandMessage-specificMessageDispatchInterceptorbuilder to register.- Returns:
- This
InterceptorRegistry, for fluent interfacing.
-
registerEventInterceptor
@Nonnull public DispatchInterceptorRegistry registerEventInterceptor(@Nonnull ComponentBuilder<MessageDispatchInterceptor<? super EventMessage>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistry- Specified by:
registerEventInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- TheEventMessage-specificMessageDispatchInterceptorbuilder to register.- Returns:
- This
InterceptorRegistry, for fluent interfacing.
-
registerQueryInterceptor
@Nonnull public DispatchInterceptorRegistry registerQueryInterceptor(@Nonnull ComponentBuilder<MessageDispatchInterceptor<? super QueryMessage>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistry- Specified by:
registerQueryInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- TheQueryMessage-specificMessageDispatchInterceptorbuilder to register.- Returns:
- This
InterceptorRegistry, for fluent interfacing.
-
registerSubscriptionQueryUpdateInterceptor
@Nonnull public DispatchInterceptorRegistry registerSubscriptionQueryUpdateInterceptor(@Nonnull ComponentBuilder<MessageDispatchInterceptor<? super SubscriptionQueryUpdateMessage>> interceptorBuilder) Description copied from interface:DispatchInterceptorRegistryRegisters the giveninterceptorBuilderfor aSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptor.- Specified by:
registerSubscriptionQueryUpdateInterceptorin interfaceDispatchInterceptorRegistry- Parameters:
interceptorBuilder- TheSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptorbuilder to register.- Returns:
- This
InterceptorRegistry, for fluent interfacing.
-
commandInterceptors
@Nonnull public List<MessageDispatchInterceptor<? super CommandMessage>> commandInterceptors(@Nonnull Configuration config) Description copied from interface:DispatchInterceptorRegistryReturns the list ofMessageDispatchInterceptorsregistered in this registry.- Specified by:
commandInterceptorsin interfaceDispatchInterceptorRegistry- Parameters:
config- The configuration to build allMessageDispatchInterceptorswith.- Returns:
- The list of
MessageDispatchInterceptorsregistered in this registry.
-
eventInterceptors
@Nonnull public List<MessageDispatchInterceptor<? super EventMessage>> eventInterceptors(@Nonnull Configuration config) Description copied from interface:DispatchInterceptorRegistryReturns the list ofEventMessage-specificMessageDispatchInterceptorsregistered in this registry.This collection contains all generic
MessageMessageDispatchInterceptorsthat have beenregisteredas well.- Specified by:
eventInterceptorsin interfaceDispatchInterceptorRegistry- Parameters:
config- The configuration to build allEventMessage-specificMessageDispatchInterceptorswith.- Returns:
- The list of
EventMessage-specificMessageDispatchInterceptors.
-
queryInterceptors
@Nonnull public List<MessageDispatchInterceptor<? super QueryMessage>> queryInterceptors(@Nonnull Configuration config) Description copied from interface:DispatchInterceptorRegistryReturns the list ofQueryMessage-specificMessageDispatchInterceptorsregistered in this registry.This collection contains all generic
MessageMessageDispatchInterceptorsthat have beenregisteredas well.- Specified by:
queryInterceptorsin interfaceDispatchInterceptorRegistry- Parameters:
config- The configuration to build allQueryMessage-specificMessageDispatchInterceptorswith.- Returns:
- The list of
QueryMessage-specificMessageDispatchInterceptors.
-
subscriptionQueryUpdateInterceptors
@Nonnull public List<MessageDispatchInterceptor<? super SubscriptionQueryUpdateMessage>> subscriptionQueryUpdateInterceptors(@Nonnull Configuration config) Description copied from interface:DispatchInterceptorRegistryReturns the list ofSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptorsregistered in this registry.This collection contains all generic
MessageMessageDispatchInterceptorsthat have beenregisteredas well.- Specified by:
subscriptionQueryUpdateInterceptorsin interfaceDispatchInterceptorRegistry- Parameters:
config- The configuration to build allSubscriptionQueryUpdateMessage-specificMessageDispatchInterceptorswith.- 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.
-