title: Making WebMQ Synchronous
body: <p>I'm trying to make WebMQ act synchronously in MULE in order to turn the message queue into a REST api for an internal project.  Unfortunately, I know very little about MULE.</p>
  
  <p>After a good bit of work, I started understanding the Request-Reply scope and tried to use the WMQ Connector with it, only to find out that WMQ only sends once the flow has ended.</p>
  
  <p>I've tried putting the request into a different flow using VM to trigger it<br>
  <img src="https://i.imgur.com/PpLnNKu.png" alt=""></p>
  
  <p>but so far that just leads to it waiting forever on WMQ that will never happen.</p>
  
  <p>I've also tried using VMs for back and forth:<br>
  <img src="https://i.imgur.com/yv4r9FB.png" alt=""></p>
  
  <p>But it seems to do the same thing as without, where it just ignores the input.</p>
  
  <p>Now I know the input and output for the WMQ are working, as I previously setup a flow that used http to communicate with itself and let it know when a message went through.</p>
  
  <p><img src="https://i.imgur.com/aFOZYAE.png" alt=""></p>
  
  <p>What I essentially want is this, but using HTTP instead of AJAX</p>
  
  <p><img src="https://i.imgur.com/hXPLGAR.png" alt=""></p>
  
  <p>My latest, and perhaps closest attempt looks like thus:
  <img src="https://i.imgur.com/h2dPM3q.png" alt=""></p>
  
  <p>The XML being:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;mule xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:http="http://www.mulesoft.org/schema/mule/http" version="EE-3.6.0" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:ajax="http://www.mulesoft.org/schema/mule/ajax" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio" xmlns:test="http://www.mulesoft.org/schema/mule/test" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ajax http://www.mulesoft.org/schema/mule/ajax/current/mule-ajax.xsd
  http://www.mulesoft.org/schema/mule/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
  http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
  http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
  http://www.mulesoft.org/schema/mule/stdio http://www.mulesoft.org/schema/mule/stdio/current/mule-stdio.xsd
  http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/schema/mule/test/current/mule-test.xsd
  http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
  http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
  http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd"&gt;
  
      &lt;wmq:connector channel="MAGENTO.SVRCONN" doc:name="WMQ Connector" hostName="[ip]" name="wmqConnector" port="1414" queueManager="MAGENTO" transportType="CLIENT_MQ_TCPIP" validateConnections="true" /&gt;
      &lt;vm:connector name="VM" validateConnections="true" doc:name="VM"&gt;
          &lt;vm:queue-profile maxOutstandingMessages="500"&gt;
              &lt;default-persistent-queue-store/&gt;
          &lt;/vm:queue-profile&gt;
      &lt;/vm:connector&gt;
      &lt;http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/&gt;
      &lt;flow  name="Input"&gt;
          &lt;http:listener config-ref="HTTP_Listener_Configuration" path="/mq" doc:name="HTTP"/&gt;
          &lt;set-payload value="#[message.inboundProperties.'http.query.params'.xml]" doc:name="Set Payload"/&gt;
          &lt;logger message="Entering Request-Reply Payload: #[payload]" level="INFO" doc:name="Logger"/&gt;
          &lt;request-reply doc:name="Request-Reply"&gt;
              &lt;vm:outbound-endpoint exchange-pattern="one-way" path="mq" connector-ref="VM" doc:name="VM_TriggerSend" /&gt;
              &lt;vm:inbound-endpoint exchange-pattern="request-response" path="mq-return" connector-ref="VM" doc:name="VM_Receive" /&gt;
          &lt;/request-reply&gt;
          &lt;logger message="Request-Reply has ended. Payload: #[payload]" level="INFO" doc:name="Logger"/&gt;
      &lt;/flow&gt;
      &lt;flow name="Send_Message"&gt;
          &lt;vm:inbound-endpoint exchange-pattern="one-way" path="mq" connector-ref="VM" doc:name="VM_Send"/&gt;
          &lt;logger message="(Preparing to Dispatch) Payload: #[payload]" level="INFO" doc:name="Logger"/&gt;
          &lt;wmq:outbound-endpoint queue="PUT_QUEUE" connector-ref="wmqConnector" doc:name="WMQ"/&gt;
          &lt;logger message="Message presumably being dispatched after this log" level="INFO" doc:name="Logger"/&gt;
      &lt;/flow&gt;
      &lt;flow name="Receive_Message"&gt;
          &lt;wmq:inbound-endpoint queue="GET_QUEUE" connector-ref="wmqConnector" doc:name="WMQ_Receive" /&gt;
          &lt;logger message="Triggering Receive" level="INFO" doc:name="Logger"/&gt;
          &lt;vm:outbound-endpoint exchange-pattern="request-response" path="mq-return" connector-ref="VM" doc:name="VM_TriggerReceive" /&gt;
      &lt;/flow&gt;
  &lt;/mule&gt;
  </code></pre>
  
  <p>Which almost works, but it hangs indefinitely without sending a response back to the HTTP server.  Setting the vm:inbound-endpoint in the Request-Reply flow to one-way keeps it from hanging, but doesn't send the new payload that's been received, but instead the previous payload (as if it's being skipped over).</p>
  
  <p>Any help at all would be greatly appreciated!</p>