Class ImmutableMessageChannelInterceptor
- java.lang.Object
- org.springframework.messaging.support.ChannelInterceptorAdapter
- org.springframework.messaging.support.ImmutableMessageChannelInterceptor
- All Implemented Interfaces:
ChannelInterceptor
public class ImmutableMessageChannelInterceptor extends ChannelInterceptorAdapter
A simpler interceptor that callsMessageHeaderAccessor.setImmutable()on the headers of messages passed through the preSend method.When configured as the last interceptor in a chain, it allows the component sending the message to leave headers mutable for interceptors to modify prior to the message actually being sent and exposed to concurrent access.
- Since:
- 4.1.2
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description ImmutableMessageChannelInterceptor()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Message<?>preSend(Message<?> message, MessageChannel channel)Invoked before the Message is actually sent to the channel.Methods inherited from class org.springframework.messaging.support.ChannelInterceptorAdapter
afterReceiveCompletion, afterSendCompletion, postReceive, postSend, preReceive
Constructor Detail
ImmutableMessageChannelInterceptor
public ImmutableMessageChannelInterceptor()
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- Overrides:
preSendin classChannelInterceptorAdapter