Can any one provide sample program to dequeue messages in Java? I want standalone java program which will do this task.
Lets say Oracle ha enqueued messages using JMS_TEXT_MESSAGE a payload type in queue “myqueue” whose owner is “myowner” & now I want to dequeue these messages using Java. Can any one provide sample program in stand alone Java?
Thanks!
@Ratha, I tried your sample & I can browse through all the messages & it works perfect!
However, when I try to consume those messages, I thought they’ll get removed from the queue & display it to me through below line:
System.out.println("MESSAGE RECEIVED " + msg.getText());
But instead, it gives me error on below line:
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)
Can you please help me how to fix this error?
Thanks!
You can right vendor specific or vendor neutral code..
To dequeue the message, use following code block
I have written, these posts, which contain more detail code;
http://vvratha.blogspot.com/2011/10/creating-queue-in-oracleaq.html
http://vvratha.blogspot.com/2011/10/java-client-for-jndi-lookup-with-ojms.html