Package org.axonframework.messaging.core
Interface MessageHandlerInterceptor<M extends Message>
- Type Parameters:
M- The message type this interceptor can process.
- All Known Implementing Classes:
BeanValidationInterceptor,CorrelationDataInterceptor,LoggingInterceptor,MessageAuthorizationHandlerInterceptor,MonitoringCommandHandlerInterceptor,MonitoringEventHandlerInterceptor,MonitoringQueryHandlerInterceptor
public interface MessageHandlerInterceptor<M extends Message>
Workflow interface that allows for customized message handler invocation chains. A MessageHandlerInterceptor can add
customized behavior to message handler invocations, both before and after the invocation.
- Since:
- 0.5.0
- Author:
- Allard Buijze, Simon Zambrovski
-
Method Summary
Modifier and TypeMethodDescriptioninterceptOnHandle(M message, ProcessingContext context, MessageHandlerInterceptorChain<M> interceptorChain) Intercepts a givenmessageon handling before reaching the designatedMessageHandler.
-
Method Details
-
interceptOnHandle
@Nonnull MessageStream<?> interceptOnHandle(@Nonnull M message, @Nonnull ProcessingContext context, @Nonnull MessageHandlerInterceptorChain<M> interceptorChain) Intercepts 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.- 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).
-