public interface ChannelInterceptor
Messages
being sent-to and/or received-from a
MessageChannel
.Message
,
MessageChannel
Modifier and Type | Method and Description |
---|---|
default void |
afterReceiveCompletion(Message<?> message,
MessageChannel channel,
java.lang.Exception ex)
Invoked after the completion of a receive regardless of any exception that
have been raised thus allowing for proper resource cleanup.
|
default void |
afterSendCompletion(Message<?> message,
MessageChannel channel,
boolean sent,
java.lang.Exception ex)
Invoked after the completion of a send regardless of any exception that
have been raised thus allowing for proper resource cleanup.
|
default Message<?> |
postReceive(Message<?> message,
MessageChannel channel)
Invoked immediately after a Message has been retrieved but before
it is returned to the caller.
|
default void |
postSend(Message<?> message,
MessageChannel channel,
boolean sent)
Invoked immediately after the send invocation.
|
default boolean |
preReceive(MessageChannel channel)
Invoked as soon as receive is called and before a Message is
actually retrieved.
|
default Message<?> |
preSend(Message<?> message,
MessageChannel channel)
Invoked before the Message is actually sent to the channel.
|
@Nullable default Message<?> preSend(Message<?> message, MessageChannel channel)
null
then the actual
send invocation will not occur.default void postSend(Message<?> message, MessageChannel channel, boolean sent)
default void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, @Nullable java.lang.Exception ex)
Note that this will be invoked only if preSend(org.springframework.messaging.Message<?>, org.springframework.messaging.MessageChannel)
successfully
completed and returned a Message, i.e. it did not return null
.
default boolean preReceive(MessageChannel channel)
@Nullable default Message<?> postReceive(Message<?> message, MessageChannel channel)
null
aborts further interceptor invocations.
This only applies to PollableChannels.default void afterReceiveCompletion(@Nullable Message<?> message, MessageChannel channel, @Nullable java.lang.Exception ex)
Note that this will be invoked only if preReceive(org.springframework.messaging.MessageChannel)
successfully
completed and returned true
.