Top Description Methods
org.springframework.messaging.support

public Interface ExecutorChannelInterceptor

extends ChannelInterceptor
Known Direct Implementers
org.springframework.messaging.simp.broker.OrderedMessageChannelDecorator.CallbackTaskInterceptor
Imports
org.springframework.lang.Nullable, org.springframework.messaging.Message, .MessageChannel, .MessageHandler

An extension of ChannelInterceptor with callbacks to intercept the asynchronous sending of a org.springframework.messaging.Message to a specific subscriber through an java.util.concurrent.Executor. Supported on org.springframework.messaging.MessageChannel implementations that can be configured with an Executor.
Author
Rossen Stoyanchev
Since
4.1
See Also
Message, MessageChannel, MessageHandler

Method Summary

Modifier and TypeMethod and Description
public default void
afterMessageHandled(Message<?>
the message handled
message
,
MessageChannel
the channel on which the message was sent to
channel
,
MessageHandler
the target handler that handled the message
handler
,
Exception
any exception that may have been raised by the handler
ex
)

Invoked inside the Runnable 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.

public default Message<?>

Returns:

the input message, or a new instance, or null
beforeHandle
(Message<?>
the message to be handled
message
,
MessageChannel
the channel on which the message was sent to
channel
,
MessageHandler
the target handler to handle the message
handler
)

Invoked inside the Runnable submitted to the Executor just before calling the target MessageHandler to handle the message.

Inherited from org.springframework.messaging.support.ChannelInterceptor:
afterReceiveCompletionafterSendCompletionpostReceivepostSendpreReceivepreSend

Method Detail

afterMessageHandledback to summary
public default void afterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler, Exception ex)

Invoked inside the Runnable 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:Message<?>

the message handled

channel:MessageChannel

the channel on which the message was sent to

handler:MessageHandler

the target handler that handled the message

ex:Exception

any exception that may have been raised by the handler

beforeHandleback to summary
public default Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler)

Invoked inside the Runnable submitted to the Executor just before calling the target MessageHandler to handle the message. Allows for modification of the Message if necessary or when null is returned the MessageHandler is not invoked.

Parameters
message:Message<?>

the message to be handled

channel:MessageChannel

the channel on which the message was sent to

handler:MessageHandler

the target handler to handle the message

Returns:Message<?>

the input message, or a new instance, or null

Annotations
@Nullable