Class ThreadStatePropagationChannelInterceptor<S>
- Type Parameters:
- S- the propagated state object type.
- All Implemented Interfaces:
- ChannelInterceptor,- ExecutorChannelInterceptor
ExecutorChannelInterceptor implementation responsible for
 the Thread (any?) state propagation from one message flow's thread to another
 through the MessageChannels involved in the flow.
 
 The propagation is done from the preSend(Message, MessageChannel)
 implementation using some internal Message extension which keeps the message
 to send and the state to propagate.
 
 The propagated state context extraction and population is done from the postReceive(org.springframework.messaging.Message<?>, org.springframework.messaging.MessageChannel)
 implementation for the PollableChannels, and from
 the beforeHandle(org.springframework.messaging.Message<?>, org.springframework.messaging.MessageChannel, org.springframework.messaging.MessageHandler) for the
 AbstractExecutorChannels and
 ExecutorSubscribableChannels
 
 Important. Any further interceptor, which modifies the message to send
 (e.g. MessageBuilder.withPayload(...)...build()), may drop the state to propagate.
 Such kind of interceptors combination should be revised properly.
 In most cases the interceptors reordering is enough to overcome the issue.
- Since:
- 4.2
- Author:
- Artem Bilan, Gary Russell
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler) protected abstract SobtainPropagatingContext(Message<?> message, MessageChannel channel) protected abstract voidpopulatePropagatedContext(S state, Message<?> message, MessageChannel channel) final Message<?> postReceive(Message<?> message, MessageChannel channel) final Message<?> preSend(Message<?> message, MessageChannel channel) Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.messaging.support.ChannelInterceptorafterReceiveCompletion, afterSendCompletion, postSend, preReceiveMethods inherited from interface org.springframework.messaging.support.ExecutorChannelInterceptorafterMessageHandled
- 
Constructor Details- 
ThreadStatePropagationChannelInterceptorpublic ThreadStatePropagationChannelInterceptor()
 
- 
- 
Method Details- 
preSend- Specified by:
- preSendin interface- ChannelInterceptor
 
- 
postReceive- Specified by:
- postReceivein interface- ChannelInterceptor
 
- 
beforeHandlepublic final Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler) - Specified by:
- beforeHandlein interface- ExecutorChannelInterceptor
 
- 
obtainPropagatingContext
- 
populatePropagatedContextprotected abstract void populatePropagatedContext(@Nullable S state, Message<?> message, MessageChannel channel) 
 
-