spring-framework / org.springframework.messaging.support / ExecutorChannelInterceptor

ExecutorChannelInterceptor

interface ExecutorChannelInterceptor : ChannelInterceptor

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

Functions

afterMessageHandled

abstract fun afterMessageHandled(message: Message<*>, channel: MessageChannel, handler: MessageHandler, ex: Exception): Unit

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.

beforeHandle

abstract fun beforeHandle(message: Message<*>, channel: MessageChannel, handler: MessageHandler): Message<*>

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.