org.springframework.messaging.support

## Class ImmutableMessageChannelInterceptor

- java.lang.Object
- - org.springframework.messaging.support.ImmutableMessageChannelInterceptor

All Implemented Interfaces:
  ChannelInterceptor

    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.

Since:
  4.1.2
Author:
  Rossen Stoyanchev

### Constructor Summary

Constructors
Constructor and Description
`ImmutableMessageChannelInterceptor()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Message<?>` `preSend(Message<?> message, MessageChannel channel)` Invoked before the Message is actually sent to the channel.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.messaging.support.ChannelInterceptor

`afterReceiveCompletion, afterSendCompletion, postReceive, postSend, preReceive`

### Constructor Detail

#### ImmutableMessageChannelInterceptor

    public ImmutableMessageChannelInterceptor()

### Method Detail

#### 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`