I am trying to get the current messages in a queue.  To do this I am using the 
JMS API Queue browsing mechanism:


final Destination queue = …;
final Connection con;
final Session session;
final QueueBrowser browser;

con = connectionFactory.createConnection();
con.start();
session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
browser = session.createBrowser((Queue) queue);

Enumeration<?> messages = browser.getEnumeration();

This works for pending messages that are in the queue at the moment the code is 
executed, but I would like to get the messages that the broker has sent to 
consumers and have not yet been acknowledged.  In other words, the messages in 
flight.

I am using the REST API to get the statistics on the queue, calling  
/api/latest/queue/vhn/vh/MyQueue and this returns two interesting counts:
  queueDepthMessages
  unacknowledgedMessages

[ Sub-question: Does the count in queueDepthMessages include 
unacknowledgedMessages?  It seems to. ]

I also see that I can call 
/api/latest/queue/linuxvm/AdobeSign/AccountDocumentRemovalQueueQ/getMessageContent
 , but this seems to require the message ID.

The Web UI  seems to be able to enumerate the messages in the queues, and I 
haven’t been able to discover what API operation on Queue (is it on queue?) 
returns that information, so perhaps a pointer to that would get me moving in 
the right direction.

Thanks for any help.
--
Tom Jordahl


Reply via email to