MCPcopy
hub / github.com/nats-io/nats.go / ConsumerNames

Method ConsumerNames

jsm.go:846–871  ·  view source on GitHub ↗

ConsumerNames is used to retrieve a list of Consumer names.

(stream string, opts ...JSOpt)

Source from the content-addressed store, hash-verified

844
845// ConsumerNames is used to retrieve a list of Consumer names.
846func (jsc *js) ConsumerNames(stream string, opts ...JSOpt) <-chan string {
847 o, cancel, err := getJSContextOpts(jsc.opts, opts...)
848 if err != nil {
849 return nil
850 }
851
852 ch := make(chan string)
853 l := &consumerNamesLister{stream: stream, js: &js{nc: jsc.nc, opts: o}}
854 go func() {
855 if cancel != nil {
856 defer cancel()
857 }
858 defer close(ch)
859 for l.Next() {
860 for _, info := range l.Page() {
861 select {
862 case ch <- info:
863 case <-o.ctx.Done():
864 return
865 }
866 }
867 }
868 }()
869
870 return ch
871}
872
873// streamCreateResponse stream creation.
874type streamCreateResponse struct {

Callers

nothing calls this directly

Calls 4

NextMethod · 0.95
PageMethod · 0.95
getJSContextOptsFunction · 0.85
DoneMethod · 0.65

Tested by

no test coverage detected