Class TracingHandlerEnhancerDefinition
- All Implemented Interfaces:
HandlerEnhancerDefinition
HandlerEnhancerDefinition that wraps annotated message handlers in a tracing span named after the handling
method (for example "BookRoomHandler.handle(BookRoom)"). Message-type agnostic: every annotated handler kind
receives the same enhancement -- the span lifecycle is driven entirely by MessageHandlingMember /
ProcessingContext. Each wrapper preserves the original member's marker interface (command, event, or query
handling member), so metamodel construction that classifies handlers by marker interface is unaffected by tracing.
Discovered via the standard META-INF/services HandlerEnhancerDefinition ServiceLoader
entry shipped with axon-messaging, so no explicit registration is required.
The configured SpanFactory is resolved from the ProcessingContext's
ApplicationContext at handle time -- when no factory is registered, the
wrapper is a pass-through.
@EventSourcingHandler suppression. Members carrying the EventSourcingHandler handler
attribute are suppressed by default: they fire once per event during entity replay (a hot path) and would flood
traces with one span per replayed event. Suppression is decided before any span name is built or the
SpanFactory is resolved, so a suppressed invocation carries no tracing cost beyond a boolean check. Set
MessagingTracingSettings.eventSourcingHandlersEnabled() to true to trace them anyway.
- Since:
- 4.6.0
- Author:
- Mitchell Herrijgers, Mateusz Nowak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> MessageHandlingMember<T> wrapHandler(MessageHandlingMember<T> original) Enhance the givenoriginalhandler.
-
Constructor Details
-
TracingHandlerEnhancerDefinition
public TracingHandlerEnhancerDefinition()
-
-
Method Details
-
wrapHandler
Description copied from interface:HandlerEnhancerDefinitionEnhance the givenoriginalhandler. Implementations may return the original message handler.- Specified by:
wrapHandlerin interfaceHandlerEnhancerDefinition- Type Parameters:
T- The type of object that will perform the actual handling of the message- Parameters:
original- The original message handler- Returns:
- The enhanced message handler
-