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

Method Consumers

jsm.go:736–761  ·  view source on GitHub ↗

Consumers is used to retrieve a list of ConsumerInfo objects.

(stream string, opts ...JSOpt)

Source from the content-addressed store, hash-verified

734
735// Consumers is used to retrieve a list of ConsumerInfo objects.
736func (jsc *js) Consumers(stream string, opts ...JSOpt) <-chan *ConsumerInfo {
737 o, cancel, err := getJSContextOpts(jsc.opts, opts...)
738 if err != nil {
739 return nil
740 }
741
742 ch := make(chan *ConsumerInfo)
743 l := &consumerLister{js: &js{nc: jsc.nc, opts: o}, stream: stream}
744 go func() {
745 if cancel != nil {
746 defer cancel()
747 }
748 defer close(ch)
749 for l.Next() {
750 for _, info := range l.Page() {
751 select {
752 case ch <- info:
753 case <-o.ctx.Done():
754 return
755 }
756 }
757 }
758 }()
759
760 return ch
761}
762
763// ConsumersInfo is used to retrieve a list of ConsumerInfo objects.
764// Deprecated: Use Consumers() instead.

Callers 1

ConsumersInfoMethod · 0.95

Calls 4

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

Tested by

no test coverage detected