Interface AsyncMessageInterceptor<T>

Type Parameters:
T - the Message payload type.

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

    • intercept

      default CompletableFuture<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 a CompletableFuture.completedFuture(null).
      Parameters:
      message - the message to be intercepted.
      Returns:
      a completable future containing the resulting message.
    • intercept

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

      default CompletableFuture<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.
      Returns:
      a completable future.
    • afterProcessing

      default CompletableFuture<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.
      Returns:
      a completable future.