Skip to content

Commit

Permalink
js: update Chan Subscribe with note about capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyqs committed Sep 16, 2022
1 parent 72a9635 commit 22afdbd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js.go
Expand Up @@ -1228,6 +1228,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 22afdbd

Please sign in to comment.