org.springframework.messaging.support

Interface ChannelInterceptor

    • Method Detail

      • preSend

        @Nullable
        default 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

        default 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

        default 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

        @Nullable
        default 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; null aborts further interceptor invocations. This only applies to PollableChannels.