ConsumerNames is used to retrieve a list of Consumer names.
(stream string, opts ...JSOpt)
| 844 | |
| 845 | // ConsumerNames is used to retrieve a list of Consumer names. |
| 846 | func (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. |
| 874 | type streamCreateResponse struct { |
nothing calls this directly
no test coverage detected