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

Function BindStream

js.go:2675–2684  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

2673// To avoid the stream lookup, provide the stream name with this function.
2674// See also `Bind()`.
2675func 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.

Callers 3

WatchFilteredMethod · 0.85
GetMethod · 0.85
WatchMethod · 0.85

Calls 2

subOptFnFuncType · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected