nats-server icon indicating copy to clipboard operation
nats-server copied to clipboard

Number of subscribers (numsub)

Open MickL opened this issue 4 years ago • 2 comments
trafficstars

In Redis there is a numsub function that returns the number of subscribers. This is important if I want to wait for a response of each subscriber. But how to do that with NATS?

Example:

  • Get number of subscribers
  • Ask each subscriber to return a count value
  • Wait for number of subscribers to respond, or timeout
  • Sum count values

MickL avatar Mar 10 '21 09:03 MickL

+1, in need for this 👀

rennokki avatar Jan 30 '22 15:01 rennokki

With the NATS cli, you can do the following to only show those connections that have subs on foo. This is not exactly what you need, but might help. Also if you add --trace to the command below you can see what raw requests and responses are being sent and received.

nats account report connections --subject=foo

derekcollison avatar Jan 30 '22 17:01 derekcollison

Closing for now but feel free to re-open as needed.

derekcollison avatar Jan 06 '23 16:01 derekcollison