Friday, April 29, 2011

Spring Integration: How does RendezvousChannel work?

I haven't been able to find any examples of how the RendezvousChannel works in Spring Integration. Does anyone know of any resources?

I've read that RendezvousChannel is useful for adapting request/response clients to the asynchronous messaging in Spring Integration.

From stackoverflow
  • RendezvousChannel extends QueueChannel and exhibits the same behaviour:

    • Reading from the channel blocks until either a message is available or a timeout occurs.
    • Writing to the channel blocks until the queue's capacity permits another message or a timeout occurs.

    Internally however, RendezvousChannel uses a capacity of 0 in conjunction with a SynchronousQueue. Therefore, senders will block until receivers have finished, well, receiving and vice versa, basically establishing synchronous communication.

    As for examples, I don't think there are any yet.

    If you want to get an impression of how RendezvousChannel can be used as temporary reply channel for implementing request/reply scenarios (as hinted at in the reference documentation, section 3.2.4), have a look at the source code of the doSendAndReceive method of MessageChannelTemplate. That one uses PollableChannel implementation internally, but the pattern could be easily transfered RendezvousChannel.

0 comments:

Post a Comment