ExecutorChannelInterceptor

An extension of {@link ChannelInterceptor} with callbacks to intercept the asynchronous sending of a {@link hunt.stomp.Message} to a specific subscriber through an {@link java.util.concurrent.Executor}. Supported on {@link hunt.stomp.MessageChannel} implementations that can be configured with an {@code Executor}.

@author Rossen Stoyanchev @since 4.1 @see Message @see MessageChannel @see MessageHandler

Members

Functions

afterMessageHandled
void afterMessageHandled(MessageBase message, MessageChannel channel, MessageHandler handler, Exception ex)

Invoked inside the {@link 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. <p>Note that this will be invoked only if beforeHandle successfully completed and returned a Message, i.e. it did not return {@code null}. @param message the message handled @param channel the channel on which the message was sent to @param handler the target handler that handled the message @param ex any exception that may been raised by the handler

beforeHandle
MessageBase beforeHandle(MessageBase message, MessageChannel channel, MessageHandler handler)

Invoked inside the {@link 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 {@code null} is returned the MessageHandler is not invoked. @param message the message to be handled @param channel the channel on which the message was sent to @param handler the target handler to handle the message @return the input message, or a new instance, or {@code null}

Inherited Members

From ChannelInterceptor

preSend
MessageBase preSend(MessageBase 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 returns {@code null} then the actual send invocation will not occur.

postSend
void postSend(MessageBase message, MessageChannel channel, bool sent)

Invoked immediately after the send invocation. The value argument represents the return value of that invocation.

afterSendCompletion
void afterSendCompletion(MessageBase message, MessageChannel channel, bool sent, Exception ex)

Invoked after the completion of a send regardless of any exception that have been raised thus allowing for proper resource cleanup. <p>Note that this will be invoked only if {@link #preSend} successfully completed and returned a Message, i.e. it did not return {@code null}. @since 4.1

preReceive
bool 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
MessageBase postReceive(MessageBase 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; {@code null} aborts further interceptor invocations. This only applies to PollableChannels.

afterReceiveCompletion
void afterReceiveCompletion(MessageBase 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. <p>Note that this will be invoked only if {@link #preReceive} successfully completed and returned {@code true}. @since 4.1

Meta