org.springframework.messaging.support

## Interface ChannelInterceptor

- All Known Implementing Classes:
    ChannelInterceptorAdapter

      public interface ChannelInterceptor

  Interface for interceptors that are able to view and/or modify the `Messages` being sent-to and/or received-from a `MessageChannel`.
  Since:
    4.0
  Author:
    Mark Fisher

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Message<?>` | `postReceive(Message<?> message, MessageChannel channel)` Invoked immediately after a Message has been retrieved but before it is returned to the caller.
    `void` | `postSend(Message<?> message, MessageChannel channel, boolean sent)` Invoked immediately after the send invocation.
    `boolean` | `preReceive(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.

- - ### Method Detail

    - #### preSend

          Message<?> preSend(Message<?> 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 `null`, then the actual send invocation will not occur.

    - #### postSend

          void postSend(Message<?> message,
                        MessageChannel channel,
                        boolean sent)

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

    - #### preReceive

          boolean 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

          Message<?> postReceive(Message<?> 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. This only applies to PollableChannels.