title: Mule 3 async-reply
body: <p>I have a flow where I receive request via webservice. I forward that request to a JMS queue using component binding. However, I would like to get async-reply from that queue and use it as response to the webservice. Do I need to use reply-to and async-reply-router in the flow? Or is there any other way to do that in Mule 3? Any pointers?</p>
  
  <pre><code>&lt;flow name="mviService"&gt;
      &lt;http:inbound-endpoint address="http://localhost:62005/mvi"
          exchange-pattern="request-response"&gt;
          &lt;cxf:jaxws-service serviceClass="com.xyz.services.mvi.MVIServicePortType" /&gt;
      &lt;/http:inbound-endpoint&gt;
      &lt;component class="com.pennmutual.services.mvi.MVIServiceImpl"&gt;
          &lt;binding interface="com.pennmutual.mvi.helper.XMLReqProcessorInterface"
              method="process121Order"&gt;
              &lt;jms:outbound-endpoint queue="mviq.121.order" /&gt;
          &lt;/binding&gt;
              &lt;/component&gt;
  
              &lt;async-reply&gt;
  
              &lt;/async-reply&gt;
  
        &lt;/flow&gt;
  </code></pre>
  
  <p>============ EDITED - SEE BELOW FOR RE-FRAMED QUESTION =================</p>
  
  <p>I think I haven't done a good job in describing the scenario. Let me try again. Here's the scenario --</p>
  
  <ol>
  <li>A client calls our service described in this flow "mviService". mviService gets XML request via HTTP/SOAP based inbound endpoint. Let's call this request as XML121Request.4</li>
  <li>A component defined in MVI "com.xyz.services.mvi.MVIServiceImpl" makes some changes in XML121Request.</li>
  <li>Forwards this XML121 to a JMS queue "mviq.121.order". It uses component binding for this. </li>
  <li>The outbound endpoint to this JMS queue is a third party web service where this request is forwarded. The third party acknowledges the receipt of XML121 and the synchronous web service call returns.</li>
  <li>The response from that third party service comes at a later point of time, which is generally couple of seconds. The response comes asynchronously. Third party invokes another webservice endpoint on MVI and sends the XML121Response.</li>
  <li>MVI puts this response in a JMS queue named "mviq.async.service.reply". </li>
  <li>The "mviService" flow needs to wait for this response and send this response (after some modification)  to caller(in step 1).</li>
  </ol>
  
  <p>I'm able to get the response from third party and this response is enqued in a queue named "mviq.async.service.reply". I would like to use/consume this message and return it as a response to first call to MVI.</p>
  
  <p>I'm trying to use "request-reply".</p>
  
  <pre><code>    &lt;request-reply timeout="60000"&gt;
          &lt;vm:outbound-endpoint path="request" /&gt;
          &lt;jms:inbound-endpoint queue="mviq.async.service.reply"
              exchange-pattern="one-way" /&gt;
      &lt;/request-reply&gt;
  </code></pre>
  
  <p>THe problem is that even though I don't want to have outbound-endpoint in this case, I still have to put one as this is required by request-reply tag. The flow waits for 60 seconds at that point of time but even if I put something in the queue "mviq.async.service.reply" the correlation ID doesn't match so the service timesout and returns an error.</p>
  
  <p>flow is mentioned below.</p>
  
  <pre><code>&lt;flow name="mviService"&gt;
      &lt;http:inbound-endpoint address="http://localhost:62005/mvi"
          exchange-pattern="request-response"&gt;
          &lt;cxf:jaxws-service serviceClass="com.xyz.services.mvi.MVIServicePortType" /&gt;
      &lt;/http:inbound-endpoint&gt;
      &lt;component class="com.pennmutual.services.mvi.MVIServiceImpl"&gt;
          &lt;binding interface="com.xyz.mvi.helper.XMLReqProcessorInterface"
              method="process121Order"&gt;
              &lt;jms:outbound-endpoint queue="mviq.121.order" /&gt;
          &lt;/binding&gt;
      &lt;/component&gt;
  
      &lt;!-- &lt;logger message="XML Correlation ID 1 is #[mule:message.headers(all)]" /&gt; --&gt;
      &lt;request-reply timeout="60000"&gt;
          &lt;vm:outbound-endpoint path="request" /&gt; &lt;!-- we don't care about this --&gt;
          &lt;jms:inbound-endpoint queue="mviq.async.service.reply"
              exchange-pattern="one-way" /&gt;
      &lt;/request-reply&gt;
          &lt;!-- &lt;component class="com.xyz.mvi.CreateMVIServiceResponse"/&gt; --&gt;
  &lt;/flow&gt;
  </code></pre>
  
  <p>===== FLow with REPLY TO =============</p>
  
  <pre><code>&lt;flow name="mviService"&gt;
      &lt;http:inbound-endpoint address="http://localhost:62005/mvi"
          exchange-pattern="request-response"&gt;
          &lt;cxf:jaxws-service serviceClass="com.xyz.services.mvi.MVIServicePortType" /&gt;
      &lt;/http:inbound-endpoint&gt;
      &lt;component class="com.xyz.services.mvi.MVIServiceImpl"&gt;
          &lt;binding interface="com.xyz.mvi.helper.XMLReqProcessorInterface"
              method="process121Order"&gt;
              &lt;jms:outbound-endpoint queue="mviq.121.order" exchange-pattern="request-response"&gt;
                  &lt;message-properties-transformer scope="outbound"&gt;
                      &lt;add-message-property key="MULE_REPLYTO" value="mviq.async.service.reply" /&gt;
                  &lt;/message-properties-transformer&gt;
              &lt;/jms:outbound-endpoint&gt;
          &lt;/binding&gt;
       &lt;/component&gt;
  &lt;/flow&gt;
  </code></pre>