title: JMS queue receive message?
body: <p>In the JMS API doc, it said:</p>
  
  <blockquote>
  <pre><code>public Message receive() throws JMSException
  </code></pre>
    
    <p>Receives the next message
    produced for this message consumer.  This call blocks indefinitely
    until a message is produced or until this message consumer is closed. </p>
    
    <p>If this receive is done within a transaction, the consumer retains the message until the transaction commits.</p>
  </blockquote>
  
  <p>Here I have three questions:
  1. in the code, do we need while-loop to receive message ? like:</p>
  
  <pre><code>while(true){
      Message msg = queue.receive();
      ....
  }
  </code></pre>
  
  <ol start="2">
  <li><p>what is the transaction setting ? how to commit a transaction ? like this:</p>
  
  <pre><code>boolean transacted = false;
  session = connection.createQueueSession(transacted, Session.AUTO_ACKNOWLEDGE);
  </code></pre></li>
  <li><p>receiveNoWait() has transaction support ? how to use it ?</p></li>
  </ol>
  
  <p>Thanks</p>