0
votes

I am new to java and jms API. I Had a small problem where i need to listen to queue and browse the queue messages. But the problem is before i browse the messages the queue get consumed. do we have any possible way to get the consumed queue messages.

i tried browsing the messages using queuebrowser. but i couldnt solve

I Mean i need to browse for the messages once the queue is consumed. i couldn't find any answers for the past 3 months.. can some one help me as i am new to this java and jms api i couldn't solve. Thanks in advance.

1
What I understand is that your message is consumed before you could listen them. Are multiple consumers listening to the queue ? If not, then please start your listener before posting any message to the queue. For your basic understanding - keep 2 instances or at least keep 2 separate files - 1 for posting and 1 for listening. Start the listening file first and then post. If posting and listening are in the same file - only 1 action will take place at a time. - Patrick

1 Answers

0
votes

If the messages are consumed from the queue they no longer exists anywhere. If you want to do that you need to work with ActiveMQ, with advisory message http://activemq.apache.org/advisory-message.html but the available informations about the message are rudimentary, another solution is to use camel routes on the broker or destinations interceptors http://activemq.apache.org/virtual-destinations.html, mirrored queues http://activemq.apache.org/mirrored-queues.html to copy messages from a queue/topic to another queue/topic and treat them when you want. Or simply use topic in place if possible.