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 Details

    • interceptOnHandle

      @Nonnull MessageStream<?> interceptOnHandle(@Nonnull M message, @Nonnull ProcessingContext context, @Nonnull MessageHandlerInterceptorChain<M> interceptorChain)
      Intercepts a given message on handling before reaching the designated MessageHandler.

      The interceptor is responsible for the continuation of the handling process by invoking the MessageHandlerInterceptorChain.proceed(Message, ProcessingContext) method on the given interceptorChain.

      The given context contains 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 the message being processed.
      interceptorChain - The interceptor chain that allows this interceptor to proceed the dispatch process.
      Returns:
      The resulting message stream from MessageHandlerInterceptorChain.proceed(Message, ProcessingContext).