title: How to make Camel pattern="InOut" work with IBM MQ
body: <p>As described here:
  <a href="https://stackoverflow.com/questions/48660536">setting ReplyToQ attribute of MQMD of IBM MQ request message with Camel</a>
  I managed to set ReplyToQ in MQMD of request properly in Camel Route, but I can't get the response in the same Route, with the IBM MQ Endpoint ("to") that I would like to use both for output (of request) and for input (of response), because it is matching wrong Correlation ID, like this:</p>
  
  <p>The OUT message was not received within: 20000 millis due reply message with correlationID: Camel-ID-MYPC-62418-1518179436629-0-5 not received on destination: queue:///REPLYQ. Exchange[ID-MYPC-62418-1518179436629-0-4]</p>
  
  <p>Namely, responding application sets CorrelationID (in MQMD) to the MessageID (from MQMD of the received request). How to make this scenario work? </p>
  
  <p>I tried with useMessageIDAsCorrelationID, but this doesn't change much the result (responses are not consumed). Another try was to set MessageID of request to some fixed value (that would not be final solution), but I can't even do that. I added this:</p>
  
  <pre><code>        &lt;setHeader headerName="JMSMessageID" id="_setHeader2"&gt;
              &lt;constant&gt;abcdefg&lt;/constant&gt;
          &lt;/setHeader&gt;
          &lt;setHeader headerName="JMSCorrelationID" id="_setHeader3"&gt;
              &lt;constant&gt;abcdefg&lt;/constant&gt;
          &lt;/setHeader&gt;
  </code></pre>
  
  <p>but this only sets CorrelationID, and I still get such things:</p>
  
  <p>The OUT message was not received within: 20000 millis due reply message with correlationID: abcdefg not received on destination: queue:///REPLYQ. Exchange[ID-MYPC-65151-1518190285422-0-3]</p>
  
  <p>Complete route definition:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:camel="http://camel.apache.org/schema/spring"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"&gt;
      &lt;bean class="org.apache.camel.component.jms.JmsComponent" id="websphere"&gt;
          &lt;property name="connectionFactory"&gt;
              &lt;bean class="com.ibm.mq.jms.MQConnectionFactory"&gt;
                  &lt;property name="transportType" value="1"/&gt;
                  &lt;property name="hostName" value="hostname"/&gt;
                  &lt;property name="port" value="port"/&gt;
                  &lt;property name="queueManager" value="qmgr_name"/&gt;
                  &lt;property name="channel" value="channel_name"/&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;!-- Define a traditional camel context here --&gt;
      &lt;camelContext id="camel" useBreadcrumb="false" xmlns="http://camel.apache.org/schema/spring"&gt;
          &lt;route id="simple-route"&gt;
              &lt;from id="request-file" uri="file://C:/mqdocuments/?fileName=request.txt"/&gt;
              &lt;log id="route-log" message="&gt;&gt;&gt; ${body}"/&gt;
              &lt;setHeader headerName="CamelJmsDestinationName" id="_setHeader1"&gt;
                  &lt;constant&gt;queue://QM_TEST/INPUTQ?targetClient=1&amp;amp;mdWriteEnabled=true&amp;amp;mdReadEnabled=true&lt;/constant&gt;
              &lt;/setHeader&gt;
              &lt;setHeader headerName="JMSMessageID" id="_setHeader2"&gt;
                  &lt;constant&gt;abcdefg&lt;/constant&gt;
              &lt;/setHeader&gt;
              &lt;setHeader headerName="JMSCorrelationID" id="_setHeader3"&gt;
                  &lt;constant&gt;abcdefg&lt;/constant&gt;
              &lt;/setHeader&gt;
              &lt;to id="_to1" pattern="InOut" uri="websphere:queue:SYSTEM.DEFAULT.LOCAL.QUEUE?replyTo=REPLYQ"/&gt;
          &lt;/route&gt;
      &lt;/camelContext&gt;
  &lt;/beans&gt;
  </code></pre>