Closed justinrush closed 3 years ago
There are two ways:
You could create a subscription that starts with the last sequence number, that would give you some idea. Note this is not depth, since the channel may be trimmed by its expiration policy.
The other way would be to use the nats-streaming-server monitoring API, you can then make an HTTP/S request to /streaming/channelsz?=channel=<name>. You can learn more about this and other endpoints here: https://docs.nats.io/nats-streaming-concepts/monitoring/endpoints#clientsz
@aricart channelsz?channel=myqueue seems like it would return the information I want, but it only seems to display messages that are processed, not ones that are waiting to be delivered. For example, if I send 10 messages out, the stats don't go up until I start receiving the deliveries on the subscription. How can I use this to see the # of messages that have been published and are awaiting delivery?
last_seq is always equal to msgs.
{
"name": "myqueue",
"msgs": 8,
"bytes": 672,
"first_seq": 1,
"last_seq": 8
}
Update: OK, I see, if I include subs into that I can get the max of last sent - thanks!
{
"name": "myqueue",
"msgs": 11,
"bytes": 924,
"first_seq": 1,
"last_seq": 11,
"subscriptions": [
{
"client_id": "client1",
"inbox": "_INBOX.ADWbRxIuEENPRfoODTZpAw",
"ack_inbox": "_INBOX.A8IxBTGteHf9PxQ7jKf45u",
"queue_name": "group1:group1",
"is_durable": true,
"is_offline": true,
"max_inflight": 1024,
"ack_wait": 30,
"last_sent": 10,
"pending_count": 0,
"is_stalled": false
}
]
}
How would I go about getting the # of messages waiting for delivery to a subscription for a particular subject? Use case is pub/sub model and knowing the queue depth.