BindStream binds a consumer to a stream explicitly based on a name. When a stream name is not specified, the library uses the subscribe subject as a way to find the stream name. It is done by making a request to the server to get list of stream names that have a filter for this subject. If the retur
(stream string)
| 2673 | // To avoid the stream lookup, provide the stream name with this function. |
| 2674 | // See also `Bind()`. |
| 2675 | func BindStream(stream string) SubOpt { |
| 2676 | return subOptFn(func(opts *subOpts) error { |
| 2677 | if opts.stream != _EMPTY_ && opts.stream != stream { |
| 2678 | return fmt.Errorf("nats: duplicate stream name (%s and %s)", opts.stream, stream) |
| 2679 | } |
| 2680 | |
| 2681 | opts.stream = stream |
| 2682 | return nil |
| 2683 | }) |
| 2684 | } |
| 2685 | |
| 2686 | // Bind binds a subscription to an existing consumer from a stream without attempting to create. |
| 2687 | // The first argument is the stream name and the second argument will be the consumer name. |
no test coverage detected