Class InterceptingEventHandlingComponent
- All Implemented Interfaces:
DescribableComponent,MessageHandler,EventHandler,EventHandlingComponent
EventHandlingComponent implementation that supports intercepting event handling through
MessageHandlerInterceptors. This component delegates actual event handling to another EventHandlingComponent
while applying configured interceptors to the message handling process.- Since:
- 5.0.0
- Author:
- Allard Buijze, Mateusz Nowak, Mitchell Herrijgers, Steven van Beelen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe order in which theInterceptingEventHandlingComponentis applied as adecoratorto anEventHandlingComponent.Fields inherited from class org.axonframework.messaging.eventhandling.DelegatingEventHandlingComponent
delegate -
Constructor Summary
ConstructorsConstructorDescriptionInterceptingEventHandlingComponent(List<MessageHandlerInterceptor<? super EventMessage>> messageHandlerInterceptors, EventHandlingComponent delegate) Constructs the component with the given delegate and interceptors. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.handle(EventMessage event, ProcessingContext context) Handles the giveneventwithin the givencontext.Methods inherited from class org.axonframework.messaging.eventhandling.DelegatingEventHandlingComponent
sequenceIdentifierFor, supportedEvents, supports
-
Field Details
-
DECORATION_ORDER
public static final int DECORATION_ORDERThe order in which theInterceptingEventHandlingComponentis applied as adecoratorto anEventHandlingComponent.As such, any decorator with a lower value will be applied to the delegate, and any higher value will be applied to the
InterceptingEventHandlingComponentitself. Using the same value can either lead to application of the decorator to the delegate or theInterceptingEventHandlingComponent, depending on the order of registration.The order of the
InterceptingEventHandlingComponentis set toInteger.MIN_VALUE + 100to ensure it is applied very early in the configuration process, but not the earliest to allow for other decorators to be applied.- See Also:
-
-
Constructor Details
-
InterceptingEventHandlingComponent
public InterceptingEventHandlingComponent(@Nonnull List<MessageHandlerInterceptor<? super EventMessage>> messageHandlerInterceptors, @Nonnull EventHandlingComponent delegate) Constructs the component with the given delegate and interceptors.- Parameters:
messageHandlerInterceptors- The list of interceptors to initialize with.delegate- The EventHandlingComponent to delegate to.
-
-
Method Details
-
handle
@Nonnull public MessageStream.Empty<Message> handle(@Nonnull EventMessage event, @Nonnull ProcessingContext context) Description copied from interface:EventHandler- Specified by:
handlein interfaceEventHandler- Overrides:
handlein classDelegatingEventHandlingComponent- Parameters:
event- The event to handle.context- The context to the giveneventis handled in.- Returns:
- An
empty streamcontaining nothing.
-
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- Overrides:
describeToin classDelegatingEventHandlingComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-