接口 ChannelInterceptor
- 所有已知子接口:
ExecutorChannelInterceptor
public interface ChannelInterceptor
Interface for interceptors that are able to view and/or modify theMessages
being sent-to and/or received-from aMessageChannel
.- 从以下版本开始:
- 4.0
- 作者:
- Mark Fisher, Rossen Stoyanchev
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 void
afterReceiveCompletion(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.void
afterSendCompletion(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.Message<?>
postReceive(Message<?> message, MessageChannel channel)
Invoked immediately after a Message has been retrieved but before it is returned to the caller.void
postSend(Message<?> message, MessageChannel channel, boolean sent)
Invoked immediately after the send invocation.boolean
preReceive(MessageChannel channel)
Invoked as soon as receive is called and before a Message is actually retrieved.Message<?>
preSend(Message<?> message, MessageChannel channel)
Invoked before the Message is actually sent to the channel.
方法详细资料
preSend
Message<?> preSend(Message<?> message, MessageChannel channel)
Invoked before the Message is actually sent to the channel. This allows for modification of the Message if necessary. If this method returnsnull
then the actual send invocation will not occur.
postSend
void postSend(Message<?> message, MessageChannel channel, boolean sent)
Invoked immediately after the send invocation. The boolean value argument represents the return value of that invocation.
afterSendCompletion
void afterSendCompletion(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.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
.- 从以下版本开始:
- 4.1
preReceive
boolean preReceive(MessageChannel channel)
Invoked 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.
postReceive
Message<?> postReceive(Message<?> message, MessageChannel channel)
Invoked immediately after a Message has been retrieved but before it is returned to the caller. The Message may be modified if necessary. This only applies to PollableChannels.
afterReceiveCompletion
void afterReceiveCompletion(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.Note that this will be invoked only if
preReceive(org.springframework.messaging.MessageChannel)
successfully completed and returnedtrue
.- 从以下版本开始:
- 4.1