How can i get list of my custom created core-nats subscriptions in c# #690
Replies: 5 comments
-
yes, if the monitoring is enabled you can just query the server using HTTP as explained in nats-io/nats.go#1682 as you pointed out. Should be fairly straight forward using
I think you can get fairly detailed information using |
Beta Was this translation helpful? Give feedback.
-
AFAIR , the HTTP end-point here only reports connection on that server, so if you're in a cluster, you'll have to know the correct server to query, and have HTTP monitoring turned on too. This is also good if you don't have access to the system account. However, if you do have access, it's a bit easier. You can use req/reply along with PING to get multiple answers from all servers at once, and pick your result. Or, if you know the server you want, ask it directly and just take one response. So and pass something like this JsonSerializer.Serialize(new { |
Beta Was this translation helpful? Give feedback.
-
Thank you @mtmk , @darkwatchuk for your responses, but i just tried the connz?subs=1 & connz?subs=detailed, only to get a bunch of encoded subscriptions? "subscriptions_list": [ is this expected? I also tried the subsz?subs=true & i got many results but some contained my subscriptions Is there some settings i can do to get only user created subscriptions & not internal subscriptions? |
Beta Was this translation helpful? Give feedback.
-
The _INBOX.> subscriptions will probably be as a result of any request/response as your requests will go out with a "Reply to this INBOX", apart from setting your own INBOX so you can track these specifically, there's not much you can do I don't think as you're sending something and then subscribing on the temporary inbox. Other ones you've seen will be as a result from your subscribe to an a stream/subject (e.g. Orders.burgers). KV watchers will come across as $KV. You should be able to use the test argument on subsz for getting a list of connections using a topic. Again this works on from http and the system account. This is good for reference too... https://docs.nats.io/running-a-nats-service/configuration/sys_accounts |
Beta Was this translation helpful? Give feedback.
-
@darkwatchuk , @mtmk , there should be someway i can get list of my own custom subscriptions. I agree what you have suggested in blog works to get all subscribers, but we dont even have ability to assign any uniqueID for a CustomSubscriber. Currently i have observed that those consumers which have queueGroup property are the ones ive created, but only based on this can i be 100% sure i get only custom created consumers? Can we attach some metadata like in consumerConfig for jetstream to distingish these as custom created?
PS: Also would it be possible to get some extra detail like last activity time on subscriber. this would help a lot too |
Beta Was this translation helpful? Give feedback.
-
I basically want to have visibility on how many subscribtions i have created in core nats. As mentioned here https://github.com/nats-io/nats.go/discussions/1682 , we can query nats server using http requirest using system events. Is that possible to do in c#?
Is there anyway i can get to know list of custom created subscriptions for visibility ?
Beta Was this translation helpful? Give feedback.
All reactions