Skip to content

Commit

Permalink
Merge pull request #1085 from nats-io/update-chan-subscribe-doc
Browse files Browse the repository at this point in the history
js: update Chan Subscribe with note about capacity
  • Loading branch information
piotrpio authored Sep 22, 2022
2 parents f410242 + 22afdbd commit 991297b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js.go
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,9 @@ func (js *js) QueueSubscribeSync(subj, queue string, opts ...SubOpt) (*Subscript
}

// 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 a default of 512k capacity in comparison.
// See important note in Subscribe()
func (js *js) ChanSubscribe(subj string, ch chan *Msg, opts ...SubOpt) (*Subscription, error) {
return js.subscribe(subj, _EMPTY_, nil, ch, false, false, opts)
Expand Down

0 comments on commit 991297b

Please sign in to comment.