Announcement Announcement Module
No announcement yet.
Syncrhonous response when dropping message on a-sync channel Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Syncrhonous response when dropping message on a-sync channel

    I'm working on a prototype that should demonstrate the viability of using Spring Integration. The scenario I'm working on foresees in a web service that should drop the payload on a channel that gets delivered to a JMS queue. Until now I have set up:

    - an inbound-gateway that drops the payload on a channel
    - a service activator (endpoint) that receives the payload via the channel (implements the method to which the webservice call is passed)
    - the endpoint drops the payload on another channel that is passed to a jms outbound channel adapter
    - the outbound channel adapter converts the payload to an appropriate format that is sent over the real JMS queue.

    I can see that the message nicely is passing the JMS so all seems to work. So what is the problem? The problem is the return. I expected that dropping the message on JMS implies that from the moment it is dropped on the queue a synchronous reply is given to the caller of the web service. For some reason there is no return. My client, the one invoking the web service, is waiting for an answer.

    Now I'm a bit lost, mainly due to in-experience with Spring Integration, where this answer should come from. Should the JMS outbound adapter send a reply? Should my endpoint, the one called by the webservice, not drop it its return value to the output-channel connected to the JMS adapter but instead leave the output-channel undefined (in my opinion implying that the response of the method called is return to the client) and instead inside the method drop the payload on an injected channel that goes to the JMS outbound adapter?

    I appreciate some suggestion helping me to understand where my problem may be.

    Just for clarification, I'm trying to drop the incoming payload on a JMS queue so that I can better manage the workload related to processing the payloads. It secondly brings that the clients, the ones sending the message, don't have to wait for the processing of it as they should receive a sync. reply at the moment that the message is given to the JMS queue.

    THanks for you ideas and help.


    it continues travelling to its final destination in an a-sync manner.

  • #2
    Channel adapters are for "one-way" integration; in the case of an outbound adapter, there is no reply.

    One choice you have is to make the final channel a publish-subscribe channel.

    Subscribe the adapter to the channel with order="1".

    Subscribe a service activator or transformer with order="2".

    If the JMS send is successful, the service will be called afterwards.

    The transformer can be as simple as

    <int:transformer input-channel="toJmsChannel" order="2" expression="'OK'" />
    With no output-channel, the result of the transformer goes to the inbound gateway.
    Last edited by Gary Russell; Dec 13th, 2012, 08:04 PM.


    • #3
      Hi Gary,

      Thanks for your clear explanation. I've tried what you've suggested and it works as a charm.