You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Tom Jordahl <tj...@adobe.com.INVALID> on 2019/10/31 15:02:44 UTC
[Broker-J] How to get unacknowledged messages?
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
Re: [Broker-J] How to get unacknowledged messages?
Posted by Tom Jordahl <tj...@adobe.com.INVALID>.
Update: For some reason the operation getMessageInfo escaped my attention.
Still interested in this question:
> [ Sub-question: Does the count in queueDepthMessages include unacknowledgedMessages? It seems to. ]
And pointers to the code in the Web UI that shows the messages in the queue.
Thanks.
--
Tom
On 10/31/19, 11:03 AM, "Tom Jordahl" <tj...@adobe.com.INVALID> wrote:
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