接口 ExecutorChannelInterceptor
- 所有超级接口:
ChannelInterceptor
public interface ExecutorChannelInterceptor extends ChannelInterceptor
An extension ofChannelInterceptorwith callbacks to intercept the asynchronous sending of aMessageto a specific subscriber through anExecutor. Supported onMessageChannelimplementations that can be configured with anExecutor.- 从以下版本开始:
- 4.1
- 作者:
- Rossen Stoyanchev
- 另请参阅:
Message,MessageChannel,MessageHandler
方法概要
所有方法 实例方法 默认方法 修饰符和类型 方法 说明 default voidafterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler, Exception ex)Invoked inside theRunnablesubmitted to the Executor after calling the target MessageHandler regardless of the outcome (i.e.default Message<?>beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler)Invoked inside theRunnablesubmitted to the Executor just before calling the target MessageHandler to handle the message.从接口继承的方法 org.springframework.messaging.support.ChannelInterceptor
afterReceiveCompletion, afterSendCompletion, postReceive, postSend, preReceive, preSend
方法详细资料
beforeHandle
@Nullable default Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler)
Invoked inside theRunnablesubmitted to the Executor just before calling the target MessageHandler to handle the message. Allows for modification of the Message if necessary or whennullis returned the MessageHandler is not invoked.- 参数:
message- the message to be handledchannel- the channel on which the message was sent tohandler- the target handler to handle the message- 返回:
- the input message, or a new instance, or
null
afterMessageHandled
default void afterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler, @Nullable Exception ex)
Invoked inside theRunnablesubmitted to the Executor after calling the target MessageHandler regardless of the outcome (i.e. Exception raised or not) thus allowing for proper resource cleanup.Note that this will be invoked only if beforeHandle successfully completed and returned a Message, i.e. it did not return
null.- 参数:
message- the message handledchannel- the channel on which the message was sent tohandler- the target handler that handled the messageex- any exception that may been raised by the handler