Hi,
I have a specific requirement.
When we start/restart the pub, we need to check the size of the last value queue. It should be zero in the start of the day, and it should be 1 during the day ( at least one message went through).
When the LVQ size is zero, we will consider it the start of the day ( no message went through).
and When the LVQ size is one, we will consider it during-day ( atleast one message went through)
What is the API or any other way to check the queue size. Please share sample code if any available?
Hi @Abhishek,
I can think of two different ways of doing this:
You could use the SEMP Monitoring API to query the number of messages on the queue (SEMP is our RESTful management API that allows you to configure/monitor/take action on the event brokers). Sample request below, but more info is here. Note that SEMP requires the use of a management user, not a client-username that would be used to connect for messaging purposes.
If you only have a client-username for messaging purposes then you could browse a queue to see that messages are present without consuming them. More info here and a tutorial using our Java API (JCSMP) to browse queues is here
You can use this SEMPv2 call to get a list of messages on a queue. It returns an array so you can simply evaluate if the array is empty or not … in the example I selected only one data property as we are not interested in the actual data …
https://[host]:[mgm_port]/SEMP/v2/monitor/msgVpns/xdk-devices/queues/[queue_name]/msgs?select=msgId
The endpoint Marc described currently doesn’t seem to return the number of spooled messages as far as I can see in the doc …
That’s weird! When I query I get the following response. Can you try the query without the ?select=msgs.count on the end and see what comes back for you? Note that I’m using VMR 9.6.0.27: