Dear Community

In the Javadoc for the interface ChannelInterceptor we have two methods available related to intercept the receive method

The first is preReceive which said

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.
I understand with the bold part, the Message did its trip through the channel and just arrived to the consumer's receive method but the Message has not extracted or retrieved yet to be used or handle it in the method

I am confused with the second method called postReceive where explains the follow

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.
I am doing an analysis for these parts

First Part
Invoked immediately after a Message has been retrieved
OK, it is clear, this happen after the message arrives from the message channel to the consumer, the method receive was called and finally the Message has been retrieved.

Second Part (I am confused here)
but before it is returned to the caller
Returned to whom? the caller, right?, but it refer to the sender or producer? and Returned what thing?

One observation about these two methods, both has this advice
This only applies to PollableChannels.
I am confused, because the PollableChannel interface has mostly these classes implementations QueueChannel, PriorityChannel, RendezvousChannel

Practically QueueChannel and PriorityChannel are the same (ignoring the priority control) but we have the follow for these channels in the section 3.1.2 Message Channel Implementations

For the QueueChannel We have
A channel that has not reached its capacity limit will store messages in its internal queue, and the send() method will return immediately even if no receiver is ready to handle the message.
I understand with the bold context the sender or producer only are worry to send the Message to the queue and thats all (return true if the Message was sent it), without matter if the consumer could receive it or not, it only put Messages to the queue of course if the limit of capacity of the queue is not full

Futhermore
Likewise, a receive call will return immediately if a message is available on the queue, but if the queue is empty, then a receive call may block until either a message is available or the timeout elapses.
The consumer is only worry to polling from the channel, the sender and the consumer are loose coupled

PriorityChannel is the same than QueueChannel with the exception of the order control about the Messages (Priority Control), therefore the previous explanation about QueueChannel is applied for PriorityChannel too

Therefore again
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.
what means the bold part?, I am confused, what should be returned to the caller or sender? and what thing should be returned?

Now for RendezvousChannel

The RendezvousChannel enables a "direct-handoff" scenario where a sender will block until another party invokes the channel's receive() method or vice-versa. Internally, this implementation is quite similar to the QueueChannel except that it uses a SynchronousQueue (a zero-capacity implementation of BlockingQueue).
Here the situation is special, I mean, it is "unlocked" while the queue is empty and Spring Integration know which method send or receive was the last called and the other part of the channel are calling the oposite method

Even worst here, what happen if for this type of channel (RendezvousChannel):

One:
The preSend return null???, we know the Message never pass to the channel to be sent it, the RendezvousChannel could be locked always?, I mean, how could know the sender itself that the Message was cancelled by an interceptor to be send it?, furthermore, the consumer never would not know about this cancellation, since it is loose coupled from the sender

Two:
The preReceive return false???, we know the Message never would be retrieved for the consumer, the RendezvousChannel could be locked always?, I mean, how could know the consumer itself that the Message was cancelled by an interceptor to be consumed?, furthermore, the sender never would not know about this cancellation, since it is loose coupled from the consumer

I mean, the sender and consumer should be no aware about the interceptors, right?

Even more, how postReceive could affect in my previous lock supposition since it could return null

Is need it a complete explanation about this postReceive behavior and lock supposition (interceptors) guys

Thanks in advanced