Interface AsyncMessageInterceptor<T>
- Type Parameters:
T- theMessagepayload type.
public interface AsyncMessageInterceptor<T>
Async interface for intercepting messages before and after execution.
- Since:
- 3.0
- Author:
- Tomaz Fernandes
-
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableFuture<Void>afterProcessing(Collection<Message<T>> messages, Throwable t) Perform an action after the listener completes either with success or error.default CompletableFuture<Void>afterProcessing(Message<T> message, Throwable t) Perform an action after the listener completes either with success or error.default CompletableFuture<Collection<Message<T>>>intercept(Collection<Message<T>> messages) Perform an action on the messages or return different ones before processing.default CompletableFuture<Message<T>>Perform an action on the message or return a different one before processing.
-
Method Details
-
intercept
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
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
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.
-