Class ChannelInterceptorAdapter
- java.lang.Object
- org.springframework.messaging.support.ChannelInterceptorAdapter
- All Implemented Interfaces:
ChannelInterceptor
- Direct Known Subclasses:
ImmutableMessageChannelInterceptor
public abstract class ChannelInterceptorAdapter extends Object implements ChannelInterceptor
AChannelInterceptorbase class with empty method implementations as a convenience.- Since:
- 4.0
- Author:
- Mark Fisher, Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description ChannelInterceptorAdapter()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterReceiveCompletion(Message<?> 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.voidafterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex)Invoked after the completion of a send regardless of any exception that have been raised thus allowing for proper resource cleanup.Message<?>postReceive(Message<?> message, MessageChannel channel)Invoked immediately after a Message has been retrieved but before it is returned to the caller.voidpostSend(Message<?> message, MessageChannel channel, boolean sent)Invoked immediately after the send invocation.booleanpreReceive(MessageChannel channel)Invoked as soon as receive is called and before a Message is actually retrieved.Message<?>preSend(Message<?> message, MessageChannel channel)Invoked before the Message is actually sent to the channel.
Constructor Detail
ChannelInterceptorAdapter
public ChannelInterceptorAdapter()
Method Detail
preSend
public Message<?> preSend(Message<?> message, MessageChannel channel)
Description copied from interface:ChannelInterceptorInvoked before the Message is actually sent to the channel. This allows for modification of the Message if necessary. If this method returnsnullthen the actual send invocation will not occur.- Specified by:
preSendin interfaceChannelInterceptor
postSend
public void postSend(Message<?> message, MessageChannel channel, boolean sent)
Description copied from interface:ChannelInterceptorInvoked immediately after the send invocation. The boolean value argument represents the return value of that invocation.- Specified by:
postSendin interfaceChannelInterceptor
afterSendCompletion
public void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex)
Description copied from interface:ChannelInterceptorInvoked after the completion of a send regardless of any exception that have been raised thus allowing for proper resource cleanup.Note that this will be invoked only if
ChannelInterceptor.preSend(org.springframework.messaging.Message<?>, org.springframework.messaging.MessageChannel)successfully completed and returned a Message, i.e. it did not returnnull.- Specified by:
afterSendCompletionin interfaceChannelInterceptor
preReceive
public boolean preReceive(MessageChannel channel)
Description copied from interface:ChannelInterceptorInvoked 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.- Specified by:
preReceivein interfaceChannelInterceptor
postReceive
public Message<?> postReceive(Message<?> message, MessageChannel channel)
Description copied from interface:ChannelInterceptorInvoked immediately after a Message has been retrieved but before it is returned to the caller. The Message may be modified if necessary. This only applies to PollableChannels.- Specified by:
postReceivein interfaceChannelInterceptor
afterReceiveCompletion
public void afterReceiveCompletion(Message<?> message, MessageChannel channel, Exception ex)
Description copied from interface:ChannelInterceptorInvoked after the completion of a receive regardless of any exception that have been raised thus allowing for proper resource cleanup.Note that this will be invoked only if
ChannelInterceptor.preReceive(org.springframework.messaging.MessageChannel)successfully completed and returnedtrue.- Specified by:
afterReceiveCompletionin interfaceChannelInterceptor