title: Not receiving reply on Websphere MQ temporary queue
body: <p>I am working with a send/receive mechanism to a Websphere MQ system.</p>
  
  <p>The xml that I send in text format should receive a reply, however I receive no reply.</p>
  
  <p>I know that the xml is being "sent" ok, since "things are happening" in the target system - it is just that I am not receiving a reply. The reply is important to me, since it could include an error message if something should fail.</p>
  
  <p>So, the reason I am not receiving a reply - I am not sure if there is a problem with my code or with the Websphere MQ configuration.</p>
  
  <p><em>Any pointers on my code or what I should ask the Websphere MQ administrators to look at are greatly appreciated!!</em></p>
  
  <p>A small self contained example to demonstrate the receive is not happening looks like this:</p>
  
  <pre><code>public class CustomQueueConnection {
      private MQQueueConnectionFactory connectionFactory;
      private MQQueueConnection connection;
  
      private void runTest() throws JMSException {
          connect();
          MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
          MQQueue queue = (MQQueue) session.createQueue("queue:///REQ_SNAPSHOT.HT");
          MQQueueSender sender = (MQQueueSender) session.createSender(queue);
          TemporaryQueue temporaryQueue = session.createTemporaryQueue();
          MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(temporaryQueue);
  
          TextMessage message = session.createTextMessage(
                  "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?&gt;\n" +
                  // my well constructed xml goes here...
          );
  
          message.setJMSReplyTo(temporaryQueue);
          sender.send(message);
          System.out.println("Sent: " + message);
          JMSMessage receivedMessage = (JMSMessage) receiver.receive(10000);
          System.out.println("Received: " + receivedMessage);
      }
  
      public boolean connect() {
          boolean connected = false;
          try {
              connectionFactory = new MQQueueConnectionFactory();
              connectionFactory.setCCSID(819);
              connectionFactory.setPort(1417);
              connectionFactory.setHostName("1.2.3.4");
              connectionFactory.setQueueManager("GATE1");
              connectionFactory.setChannel("CLIENTS.CHANNEL");
              connectionFactory.setTemporaryModel("GATEWAY_MODEL_QUEUE");
              connectionFactory.setTempQPrefix("MACHINE.USER_NAME.*");
              connectionFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
  
              connection = (MQQueueConnection) connectionFactory.createQueueConnection();
              connected = true;
          } catch (JMSException e) {
              connected = false;
          }
          return connected;
      }
  
      public static void main(String[] args) throws JMSException {
          new CustomQueueConnection().runTest();
      }
  
  }
  </code></pre>
  
  <p>And here is the output:</p>
  
  <pre><code>Sent:
          JMS Message class: jms_text
          JMSType:         null
          JMSDeliveryMode: 2
          JMSExpiration:   0
          JMSPriority:     4
          JMSMessageID:    ID:414d512050314f47415445312020202053599032201b4d05
          JMSTimestamp:    1398680728618
          JMSCorrelationID:null
          JMSDestination:  queue:///REQ_SNAPSHOT.HT
          JMSReplyTo:      queue://GATE1/MACHINE.USER_NAME.53599032201B4E04?persistence=1
          JMSRedelivered:  false
          JMS_IBM_PutDate:20140428
          JMSXAppID:WebSphere MQ Client for Java
          JMS_IBM_PutApplType:28
          JMSXUserID:aomis
          JMS_IBM_PutTime:10252859
          JMSXDeliveryCount:0
  &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;esb:esbMessage xmlns:esb="http://ESBServices
          Another 557 character(s) omitted
          Received: null
  </code></pre>
  
  <p>(NB: Received: null)</p>
  
  <p>edit: Websphere MQ version is 6.0.25</p>