title: How to kick off a mule flow to read messages from a JMS queue using an HTTP endpoint
body: <p>I basically have two flows :</p>
  <ol>
  <li>HTTP Inbound endpoint receives batch XML, splits to individual pieces and stages it to a JMS queue.</li>
  <li>Reads the staged XMLs from the JMS queue and processes the messages.</li>
  </ol>
  <p>I need to control the execution of flow 2 above using a Rest call (i.e) flow 2 should run only when an HTTP inbound call is received. I am using Mule version 3.2.2</p>
  <p>Here are the flows:</p>
  <pre><code> &lt;flow name=&quot;flow-stage-input&quot;&gt;
     &lt;http:inbound-endpoint   host=&quot;localhost&quot; 
                  port=   &quot;8082&quot; 
                  path=   &quot;test/order&quot;
                  exchange-pattern=   &quot;request-response&quot;
                              &gt;
                                
     &lt;/http:inbound-endpoint&gt;
    &lt;object-to-string-transformer&gt;&lt;/object-to-string-transformer&gt;
    &lt;splitter evaluator=&quot;xpath&quot; expression=&quot;//Test/TestNode&quot; enableCorrelation=&quot;ALWAYS&quot;/&gt;
    &lt;custom-transformer class=&quot;org.testing.transformers.DocumentToString&quot;&gt;&lt;/custom-transformer&gt;
  
    &lt;pooled-component&gt;
          &lt;spring-object bean=&quot;receiver&quot;&gt;&lt;/spring-object&gt;
    &lt;/pooled-component&gt;
      
    &lt;!-- DECIDE SUCCESS OR FAILURE --&gt; 
    &lt;choice&gt;
          &lt;when expression=&quot;//Test/TestNode&quot; evaluator=&quot;xpath&quot;&gt;
      &lt;jms:outbound-endpoint queue=&quot;stagingQueue&quot; exchange-pattern=&quot;one-way&quot; connector-ref=&quot;jmsConnector&quot; /&gt;
      &lt;/when&gt;
      &lt;otherwise&gt;
          &lt;logger message=&quot;Skipped staging message due to errors&quot; level=&quot;ERROR&quot; /&gt; 
      &lt;/otherwise&gt;
    &lt;/choice&gt;
    &lt;collection-aggregator&gt;&lt;/collection-aggregator&gt;
    &lt;custom-transformer class=&quot;org.testing.transformers.ListOfStringsToString&quot;&gt;&lt;/custom-transformer&gt;
    &lt;!-- RESPONSE SENT BACK TO CALLER --&gt;
  &lt;/flow&gt;
  </code></pre>
  <hr />
  <pre><code>&lt;flow name=&quot;flow-process-jms-input&quot; &gt; 
     &lt;jms:inbound-endpoint  queue=&quot;stagingQueue&quot; exchange-pattern=&quot;one-way&quot; connector-ref=&quot;jmsConnector&quot; /&gt;
     &lt;pooled-component&gt;
      &lt;spring-object bean=&quot;processor&quot;&gt;&lt;/spring-object&gt;
     &lt;/pooled-component&gt;
     &lt;!-- DECIDE SUCCESS OR FAILURE  --&gt;
     &lt;choice&gt;
           &lt;when expression=&quot;//ErrorCondition/Path&quot; evaluator=&quot;xpath&quot;&gt;
          &lt;jms:outbound-endpoint queue=&quot;errorQueue&quot; exchange-pattern=&quot;one-way&quot; connector-ref=&quot;jmsConnector&quot; /&gt;
       &lt;/when&gt;
       &lt;otherwise&gt;
          &lt;logger message=&quot;Message processed successfully&quot; level=&quot;ERROR&quot; /&gt; 
       &lt;/otherwise&gt;
     &lt;/choice&gt;
   &lt;/flow&gt;
  </code></pre>