Announcement Announcement Module
Collapse
No announcement yet.
How does Spring Integration correlate messages? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How does Spring Integration correlate messages?

    Lets say that I choose to expose a Spring-WS inbound gateway. While servicing that request, that message may travel across sync/async channels (different threads) to get work done within Spring Integration. When finally finished, how does Spring Integration correlate the reply message (which may have navigated multiple threads) with the original request message in a multi-threaded environment?

    -Joe

  • #2
    The gateway creates a TemporaryReplyChannel object, which is inserted into the replyChannel header, and the gateway waits for a reply.

    In fact, if you explicitly send to the gateway's reply-channel (if declared), all that happens is that channel gets bridged to the replyChannel header.

    It is important not to lose that header en-route.

    Comment


    • #3
      Be aware that, if you go async, the gateway's default timeout is 1 second; this can be increased with reply-timeout.

      Comment


      • #4
        Gary,

        Thanks for the quick reply. I am still not clear on how this works though. In a sync. model, all of this would occur on the same thread. If we mixed some async. calls in here, how does the TemporaryReplyChannel object help sync up the reply to the originating request/thread?

        Comment


        • #5
          The container thread (for a ws inbound gateway), creates a temporary channel, puts it in the header and then waits on its receive(timeout) method.

          The header is passed along to each component (async or not).

          The final consumer (an element that has no output-channel, or one that sends the reply to the gateway's reply-channel) sends the message to that temporary channel, thus waking up the container thread with the result from the receive().

          The correlation is the replyChannel header.

          Comment

          Working...
          X