Interface MessageInterceptor<T>

Type Parameters:
T - the Message payload type.

public interface MessageInterceptor<T>
Interface for intercepting messages before and after execution.
Since:
3.0
Author:
Tomaz Fernandes
  • Method Details

    • intercept

      default Message<T> intercept(Message<T> message)
      Perform an action on the message or return a different one before processing. Executed before processing. This method must not return null.
      Parameters:
      message - the message to be intercepted.
      Returns:
      a completable future containing the resulting message.
    • intercept

      default Collection<Message<T>> intercept(Collection<Message<T>> messages)
      Perform an action on the messages or return a different ones before processing. Executed before processing. This method must not return null or an empty collection.
      Parameters:
      messages - the message to be intercepted.
      Returns:
      a completable future containing the resulting message.
    • afterProcessing

      default void afterProcessing(Message<T> message, @Nullable Throwable t)
      Perform an action after the listener completes either with success or error.
      Parameters:
      message - the message to be intercepted.
    • afterProcessing

      default void afterProcessing(Collection<Message<T>> messages, @Nullable Throwable t)
      Perform an action after the listener completes either with success or error.
      Parameters:
      messages - the messages to be intercepted.