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

Method subscribe

nats.go:4884–4891  ·  view source on GitHub ↗

subscribe is the internal subscribe function that indicates interest in a subject.

(subj, queue string, cb MsgHandler, ch chan *Msg, errCh chan (error), isSync bool, js *jsSub)

Source from the content-addressed store, hash-verified

4882
4883// subscribe is the internal subscribe function that indicates interest in a subject.
4884func (nc *Conn) subscribe(subj, queue string, cb MsgHandler, ch chan *Msg, errCh chan (error), isSync bool, js *jsSub) (*Subscription, error) {
4885 if nc == nil {
4886 return nil, ErrInvalidConnection
4887 }
4888 nc.mu.Lock()
4889 defer nc.mu.Unlock()
4890 return nc.subscribeLocked(subj, queue, cb, ch, errCh, isSync, js)
4891}
4892
4893func (nc *Conn) subscribeLocked(subj, queue string, cb MsgHandler, ch chan *Msg, errCh chan (error), isSync bool, js *jsSub) (*Subscription, error) {
4894 if nc == nil {

Callers 9

oldRequestMethod · 0.95
SubscribeMethod · 0.95
ChanSubscribeMethod · 0.95
ChanQueueSubscribeMethod · 0.95
SubscribeSyncMethod · 0.95
QueueSubscribeMethod · 0.95
QueueSubscribeSyncMethod · 0.95
oldRequestWithContextMethod · 0.95

Calls 1

subscribeLockedMethod · 0.95

Tested by

no test coverage detected