Interface ExecutorChannelInterceptor
- All Superinterfaces:
ChannelInterceptor
public interface ExecutorChannelInterceptor extends ChannelInterceptor
An extension ofChannelInterceptor
with callbacks to intercept the asynchronous sending of aMessage
to a specific subscriber through anExecutor
. Supported onMessageChannel
implementations that can be configured with an Executor.- Since:
- 4.1
- Author:
- Rossen Stoyanchev
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
afterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler, Exception ex)
Invoked inside theRunnable
submitted to the Executor after calling the target MessageHandler regardless of the outcome (i.e.Message<?>
beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler)
Invoked inside theRunnable
submitted to the Executor just before calling the target MessageHandler to handle the message.Methods inherited from interface org.springframework.messaging.support.ChannelInterceptor
afterReceiveCompletion, afterSendCompletion, postReceive, postSend, preReceive, preSend
Method Detail
beforeHandle
Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler)
Invoked inside theRunnable
submitted to the Executor just before calling the target MessageHandler to handle the message. Allows for modification of the Message if necessary or whennull
is returned the MessageHandler is not invoked.- Parameters:
message
- the message to be handledchannel
- the channel on which the message was sent tohandler
- the target handler to handle the message- Returns:
- the input message, or a new instance, or
null
afterMessageHandled
void afterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler, Exception ex)
Invoked inside theRunnable
submitted 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
.- Parameters:
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