Search in sources :

Example 1 with ExecutorChannelInterceptor

use of org.springframework.messaging.support.ExecutorChannelInterceptor in project spring-integration by spring-projects.

the class PollingConsumer method applyBeforeHandle.

private Message<?> applyBeforeHandle(Message<?> message, Deque<ExecutorChannelInterceptor> interceptorStack) {
    Message<?> theMessage = message;
    for (ChannelInterceptor interceptor : this.channelInterceptors) {
        if (interceptor instanceof ExecutorChannelInterceptor) {
            ExecutorChannelInterceptor executorInterceptor = (ExecutorChannelInterceptor) interceptor;
            theMessage = executorInterceptor.beforeHandle(theMessage, this.inputChannel, this.handler);
            if (message == null) {
                if (logger.isDebugEnabled()) {
                    logger.debug(executorInterceptor.getClass().getSimpleName() + " returned null from beforeHandle, i.e. precluding the send.");
                }
                triggerAfterMessageHandled(null, null, interceptorStack);
                return null;
            }
            interceptorStack.add(executorInterceptor);
        }
    }
    return theMessage;
}
Also used : ExecutorChannelInterceptor(org.springframework.messaging.support.ExecutorChannelInterceptor) ExecutorChannelInterceptor(org.springframework.messaging.support.ExecutorChannelInterceptor) ChannelInterceptor(org.springframework.messaging.support.ChannelInterceptor)

Aggregations

ChannelInterceptor (org.springframework.messaging.support.ChannelInterceptor)1 ExecutorChannelInterceptor (org.springframework.messaging.support.ExecutorChannelInterceptor)1