Class MonitoringCommandHandlerInterceptor
java.lang.Object
org.axonframework.messaging.monitoring.interception.MonitoringCommandHandlerInterceptor
- All Implemented Interfaces:
MessageHandlerInterceptor<CommandMessage>
public class MonitoringCommandHandlerInterceptor
extends Object
implements MessageHandlerInterceptor<CommandMessage>
A
MessageHandlerInterceptor for CommandMessage that intercepts the
MessageHandlerInterceptorChain to register the
MessageMonitor.MonitorCallback functions on the ProcessingContext hooks.
Invoked by the InterceptingCommandBus.
Commands are only monitored when handled.- Since:
- 5.0.0
- Author:
- Jan Galinski
-
Constructor Summary
ConstructorsConstructorDescriptionMonitoringCommandHandlerInterceptor(MessageMonitor<? super CommandMessage> messageMonitor) Constructs a MonitoringCommandHandlerInterceptor using the givenMessageMonitor. -
Method Summary
Modifier and TypeMethodDescriptioninterceptOnHandle(CommandMessage message, ProcessingContext context, MessageHandlerInterceptorChain<CommandMessage> interceptorChain) Intercepts a givenmessageon handling before reaching the designatedMessageHandler.
-
Constructor Details
-
MonitoringCommandHandlerInterceptor
public MonitoringCommandHandlerInterceptor(@Nonnull MessageMonitor<? super CommandMessage> messageMonitor) Constructs a MonitoringCommandHandlerInterceptor using the givenMessageMonitor.- Parameters:
messageMonitor- TheMessageMonitorinstance used for reporting.
-
-
Method Details
-
interceptOnHandle
@Nonnull public MessageStream<?> interceptOnHandle(@Nonnull CommandMessage message, @Nonnull ProcessingContext context, @Nonnull MessageHandlerInterceptorChain<CommandMessage> interceptorChain) Description copied from interface:MessageHandlerInterceptorIntercepts a givenmessageon handling before reaching the designatedMessageHandler. The interceptor is responsible for the continuation of the handling process by invoking theMessageHandlerInterceptorChain.proceed(Message, ProcessingContext)method on the giveninterceptorChain. The givencontextcontains contextual information. Any information gathered by interceptors may be attached to the context. Interceptors are not allowed to change the type of the message handling result, as the dispatching component expects a result of a specific type.- Specified by:
interceptOnHandlein interfaceMessageHandlerInterceptor<CommandMessage>- Parameters:
message- The message to intercept on handling.context- The active processing context of themessagebeing processed.interceptorChain- The interceptor chain that allows this interceptor to proceed the dispatch process.- Returns:
- The resulting message stream from
MessageHandlerInterceptorChain.proceed(Message, ProcessingContext).
-