title: Standalone Java to dequeue JMS messages
body: <p>Can any one provide sample program to dequeue messages in Java? I want standalone java program which will do this task. </p>
  
  <p>Lets say Oracle ha enqueued messages using <code>JMS_TEXT_MESSAGE</code> a payload type in queue "<code>myqueue</code>" whose owner is "<code>myowner</code>" &amp; now I want to dequeue these messages using Java. Can any one provide sample program in stand alone Java?</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>@Ratha, I tried your sample &amp; I can browse through all the messages &amp; it works perfect!</p>
  
  <p>However, when I try to consume those messages, I thought they'll get removed from the queue &amp; display it to me through below line:</p>
  
  <pre><code> System.out.println("MESSAGE RECEIVED " + msg.getText());
  </code></pre>
  
  <p>But instead, it gives me error on below line:</p>
  
  <pre><code> MessageConsumer consumer = session.createConsumer(queue);
  
  Exception in thread "main" java.lang.AbstractMethodError: oracle.jms.AQjmsSession.createConsumer(Ljavax/jms/Destination;)Ljavax/jms/MessageConsumer;
  at OracleAQClient.consumeMessage(OracleAQClient.java:141)
  at OracleAQClient.main(OracleAQClient.java:159)
  </code></pre>
  
  <p>Can you please help me how to fix this error?</p>
  
  <p>Thanks!</p>