3 Replies Latest reply on Apr 14, 2008 3:35 AM by Johannes Hartmann

    Reply from asynchrnous JMS Call

    Johannes Hartmann Newbie


      I want to invoke a service using JMS, which works perfect. However, I also want to receive the response of the service, which doesn't work at all.
      First the config used for testing:

       <jms-provider name="JMS-Provider"
       <jms-bus busid="EchoJmsEsbChannel">
       <jms-message-filter dest-type="QUEUE"
       dest-name="queue/inet_esb_test_echojms" />
       <jms-bus busid="EchoJmsEsbGateway">
       <jms-message-filter dest-type="QUEUE"
       dest-name="queue/inet_esb_test_echojms_gw" />
       <service category="EchoJmsEsb" name="EchoForward" description="incredible long description">
       <jms-listener name="JMS-ESBListener"
       busidref="EchoJmsEsbChannel" maxThreads="5"/>
       <jms-listener name="JMS-Gateway"
       is-gateway="true" busidref="EchoJmsEsbGateway" maxThreads="5"/>
       <actions mep="RequestResponse">

      Using this configuration, responses won't get send back to the caller, which is pretty logic, as the JMS-Gateway can only be used in one way (as far as I understand) and thus ReplyTo isn't set in the Messageheader. (At least ReplyTo is not set when getting to the first action in the pipeline)

      Is there an easy way for getting the reply back to the caller? I don't want to write something like an action at the end of the pipeline, which sends the reply to a JMS Queue or something like a "ReplyTo-Header-Enricher"-action if not absolutly nessecary.

      Thanks & Greetings

        • 1. Re: Reply from asynchrnous JMS Call
          Johannes Hartmann Newbie

          ah, sorry, forgot that there is a JMSRouter - solved the problem with it :)

          • 2. Re: Reply from asynchrnous JMS Call
            David Sun Newbie

            Would you please share more info on your solution? Thanks

            • 3. Re: Reply from asynchrnous JMS Call
              Johannes Hartmann Newbie

              I only added a action with JMSRouter to the action pipeline, which sends the answer from the previous actions to a given JMS-queue:

              <actions mep="OneWay">
               <action name="anyActions"
               <property name="wsdl" value="http://somewhere/svc?wsdl" />
               <property name="SOAPAction" value="doSomething" />
               <!-- some more actions if required -->
               <action name="routeBack"
               <property name="jndiName" value="queue/inet_esb_test_echojms_soapclient_reply" />
               <property name="unwrap" value="true" />

              Another possibility (without JMSRouter) is to set JMSReplyTo before sending the message to the bus:
              ObjectMessage msg = session.createObjectMessage(content);

              The Property MEP has to be set to "RequestResponse" in this case. Additionally, the message you get back isn't unwrapped, thus not really understandable for a ESB-unaware receiver. So I prefer the first solution.

              Hope this helps