Class ImmutableMessageChannelInterceptor

All Implemented Interfaces:

public class ImmutableMessageChannelInterceptor extends Object implements ChannelInterceptor
A simpler interceptor that calls MessageHeaderAccessor.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.

Rossen Stoyanchev
  • Constructor Details

    • ImmutableMessageChannelInterceptor

      public ImmutableMessageChannelInterceptor()
  • Method Details

    • preSend

      public Message<?> preSend(Message<?> message, MessageChannel channel)
      Description copied from interface: ChannelInterceptor
      Invoked before the Message is actually sent to the channel. This allows for modification of the Message if necessary. If this method returns null then the actual send invocation will not occur.
      Specified by:
      preSend in interface ChannelInterceptor