nats-io / jsm.go

JetStream Management Library for Golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: API for server/cluster info

mprimi opened this issue · comments

I would find useful to have an API to learn about the cluster state, not specific to any streams or consumers.

JSM seems like a good place for it.

Looking at the natscli, I see that the implementation of server list is doing this via PING (source).

I could duplicate this code, but that seems like a fragile approach.

Could the natscli implementation get pushed down to JSM, where it can be reused?

I have considered it :) but these things like PING isn’t well managed under semver and often breaking changes so I don’t really wanted to build public APIs around them :(

Makes sense, looks like a lot of refactoring for relatively small set of use cases.

For anyone stumbling upon this.
I wanted that API to block until a newly created cluster is "ready".

As a workaround, manager.IsJetStreamEnabled seems to work well for the specific use case.

Yeah probsbly ok since account info api depends on meta.

Elsewhere I check like this https://github.com/ripienaar/nats-integration/blob/0b6e12360b30bd358479125769102436cd830455/suites/streams/suite_test.go#L103 I really really dislike these server info responses since they require the silly multi unmarshal to use. Really unfriendly