title: Mule 3 : async reply w/ reply on different main flow thread
body: <p>I'm new to Mule, and am working on a problem that requires a flow that diapatches messages to a Mule message bus that listeners can receive to also receive notification of successful processing of those messages when the workers are done. The main criteria is that the 'dispatcher flow' not be blocked from continuing to do its work (of placing other different messages on the bus for potentially other listeners).</p>
  
  <p>I have a test app that I've been running in MuleStudio (below) that encapsultates the basics of what I'm trying to achieve, simplified; this is a very simple 2 flow app, using request-reply to allow the 2nd flow to send a reply back to the main flow; the main issue here is that the main flow's thread is blocked, preventing it from doing anything until the response comes back. Is there a way to have the response come back on a different thread of the main flow, or are there other ways of accomplishing this given the criteria ?</p>
  
  <p>Thanks for any help or pointers ;-)</p>
  
  
  
  <p>...
      </p>
  
  <pre><code>&lt;!-- simple Groovy transformer that changes the msg payload to a greeting w/ the current time--&gt;
  &lt;scripting:transformer name="toCurrentTime"&gt;
      &lt;scripting:script engine="groovy"&gt;
          import java.text.SimpleDateFormat;
  
          def DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";    
          def cal = Calendar.getInstance();
          def sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
          return "Response @ time " + sdf.format(cal.getTime())
  
      &lt;/scripting:script&gt;    
  &lt;/scripting:transformer&gt;
  
  
  &lt;!-- 
      note : neither of the following are allowed on the flow b/c of the request-reply    
      processingStrategy="synchronous"
      processingStrategy="queued-asynchronous"
  --&gt;
  
  &lt;flow name="main" doc:name="main"&gt;
  
      &lt;http:inbound-endpoint ref="httpEventInjector" doc:name="HTTP"/&gt;
  
      &lt;logger message="starting main flow" level="INFO"/&gt;
  
      &lt;request-reply storePrefix="mainFlow"&gt;  
          &lt;vm:outbound-endpoint path="worker"&gt;&lt;/vm:outbound-endpoint&gt;
          &lt;vm:inbound-endpoint path="reply"&gt;&lt;/vm:inbound-endpoint&gt; 
      &lt;/request-reply&gt;
  
  
      &lt;!--  processing continues once we get the response on the 'reply' channel above from the worker --&gt;    
      &lt;!--  generate the response for the browser --&gt;    
      &lt;logger message="finishing main flow w/ browser response" level="INFO"/&gt;        
      &lt;response&gt;
          &lt;transformer ref="toCurrentTime"/&gt;
      &lt;/response&gt;
  &lt;/flow&gt;
  
  
  &lt;flow name="worker" doc:name="worker"&gt;      
      &lt;vm:inbound-endpoint path="worker"/&gt;
  
      &lt;logger message="starting worker task(s) ...." level="INFO"/&gt;
  
      &lt;scripting:component doc:name="thread-sleep(10s)"&gt;
          &lt;scripting:script engine="Groovy"&gt;
              System.out.println "about to sleep @ time" + System.currentTimeMillis()
              Thread.sleep(10000);    
              System.out.println "done sleeping @ time" + System.currentTimeMillis()
          &lt;/scripting:script&gt;
      &lt;/scripting:component&gt;
  
  
      &lt;logger message="finishing up worker task(s) ...." level="INFO"/&gt;
  &lt;/flow&gt;    
  </code></pre>
  
  <p></p>