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

Method ChanSubscribe

js.go:1539–1541  ·  view source on GitHub ↗

ChanSubscribe creates channel based Subscription. Using ChanSubscribe without buffered capacity is not recommended since it will be prone to dropping messages with a slow consumer error. Make sure to give the channel enough capacity to handle bursts in traffic, for example other Subscribe APIs use

(subj string, ch chan *Msg, opts ...SubOpt)

Source from the content-addressed store, hash-verified

1537// capacity to handle bursts in traffic, for example other Subscribe APIs use a default of 512k capacity in comparison.
1538// See important note in Subscribe()
1539func (js *js) ChanSubscribe(subj string, ch chan *Msg, opts ...SubOpt) (*Subscription, error) {
1540 return js.subscribe(subj, _EMPTY_, nil, ch, false, false, opts)
1541}
1542
1543// ChanQueueSubscribe creates channel based Subscription with a queue group.
1544// See important note in QueueSubscribe()

Callers

nothing calls this directly

Calls 1

subscribeMethod · 0.95

Tested by

no test coverage detected