Example usage for org.springframework.messaging.support ChannelInterceptor preSend

List of usage examples for org.springframework.messaging.support ChannelInterceptor preSend

Introduction

In this page you can find the example usage for org.springframework.messaging.support ChannelInterceptor preSend.

Prototype

@Nullable
default Message<?> preSend(Message<?> message, MessageChannel channel) 

Source Link

Document

Invoked before the Message is actually sent to the channel.

Usage

From source file:org.springframework.messaging.support.ChannelInterceptorChain.java

public Message<?> preSend(Message<?> message, MessageChannel channel) {
    Message<?> originalMessage = message;
    for (ChannelInterceptor interceptor : this.interceptors) {
        message = interceptor.preSend(message, channel);
        if (message == null) {
            if (logger.isTraceEnabled()) {
                logger.trace("preSend returned null (precluding the send)");
            }/*from ww  w  . j  a v a2  s  .c om*/
            return null;
        }
    }
    if (logger.isDebugEnabled()) {
        if (message != originalMessage) {
            logger.debug("preSend returned modified message, new message=" + message);
        }
    }
    return message;
}