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

Method SubscribeSync

nats.go:4820–4830  ·  view source on GitHub ↗

SubscribeSync will express interest on the given subject. Messages will be received synchronously using Subscription.NextMsg().

(subj string)

Source from the content-addressed store, hash-verified

4818// SubscribeSync will express interest on the given subject. Messages will
4819// be received synchronously using Subscription.NextMsg().
4820func (nc *Conn) SubscribeSync(subj string) (*Subscription, error) {
4821 if nc == nil {
4822 return nil, ErrInvalidConnection
4823 }
4824 mch := make(chan *Msg, nc.Opts.SubChanLen)
4825 var errCh chan error
4826 if nc.Opts.PermissionErrOnSubscribe {
4827 errCh = make(chan error, 100)
4828 }
4829 return nc.subscribe(subj, _EMPTY_, nil, mch, errCh, true, nil)
4830}
4831
4832// QueueSubscribe creates an asynchronous queue subscriber on the given subject.
4833// All subscribers with the same queue name will form the queue group and

Callers 1

TestNilConnectionFunction · 0.95

Calls 1

subscribeMethod · 0.95

Tested by 1

TestNilConnectionFunction · 0.76