Interface MessageDispatchInterceptor<T extends Message<?>>

Type Parameters:
T - The message type this interceptor can process
All Known Implementing Classes:
BeanValidationInterceptor, BeanValidationInterceptor, EventLoggingInterceptor, LoggingInterceptor, MessageAuthorizationDispatchInterceptor

public interface MessageDispatchInterceptor<T extends Message<?>>
Interceptor that allows messages to be intercepted and modified before they are dispatched. This interceptor provides a very early means to alter or reject Messages, even before any Unit of Work is created.
Since:
2.0
Author:
Allard Buijze
  • Method Summary

    Modifier and Type
    Method
    Description
    handle(List<? extends T> messages)
    Apply this interceptor to the given list of messages.
    default T
    handle(T message)
    Invoked each time a message is about to be dispatched.
  • Method Details

    • handle

      @Nonnull default T handle(@Nonnull T message)
      Invoked each time a message is about to be dispatched. The given message represents the message being dispatched.
      Parameters:
      message - The message intended to be dispatched
      Returns:
      the message to dispatch
    • handle

      @Nonnull BiFunction<Integer,T,T> handle(@Nonnull List<? extends T> messages)
      Apply this interceptor to the given list of messages. This method returns a function that can be invoked to obtain a modified version of messages at each position in the list.
      Parameters:
      messages - The Messages to pre-process
      Returns:
      a function that processes messages based on their position in the list