Interface ChannelInterceptor
- All Known Subinterfaces:
- ExecutorChannelInterceptor
- All Known Implementing Classes:
- ImmutableMessageChannelInterceptor
public interface ChannelInterceptor
Interface for interceptors that are able to view and/or modify the
 
Messages being sent-to and/or received-from a
 MessageChannel.- Since:
- 4.0
- Author:
- Mark Fisher, Rossen Stoyanchev
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptiondefault voidafterReceiveCompletion(Message<?> message, MessageChannel channel, Exception ex) Invoked after the completion of a receive regardless of any exception that have been raised thus allowing for proper resource cleanup.default voidafterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, 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 voidpostSend(Message<?> message, MessageChannel channel, boolean sent) Invoked immediately after the send invocation.default booleanpreReceive(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.
- 
Method Details- 
preSendInvoked before the Message is actually sent to the channel. This allows for modification of the Message if necessary. If this method returnsnullthen the actual send invocation will not occur.
- 
postSendInvoked immediately after the send invocation. The boolean value argument represents the return value of that invocation.
- 
afterSendCompletiondefault void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, @Nullable Exception ex) Invoked after the completion of a send regardless of any exception that have been raised thus allowing for proper resource cleanup.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 returnnull.- Since:
- 4.1
 
- 
preReceiveInvoked as soon as receive is called and before a Message is actually retrieved. If the return value is 'false', then no Message will be retrieved. This only applies to PollableChannels.
- 
postReceiveInvoked immediately after a Message has been retrieved but before it is returned to the caller. The Message may be modified if necessary;nullaborts further interceptor invocations. This only applies to PollableChannels.
- 
afterReceiveCompletiondefault void afterReceiveCompletion(@Nullable Message<?> message, MessageChannel channel, @Nullable Exception ex) Invoked after the completion of a receive regardless of any exception that have been raised thus allowing for proper resource cleanup.Note that this will be invoked only if preReceive(org.springframework.messaging.MessageChannel)successfully completed and returnedtrue.- Since:
- 4.1
 
 
-