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

Method Stop

jetstream/push.go:211–222  ·  view source on GitHub ↗

Stop unsubscribes from the stream and cancels subscription. No more messages will be received after calling this method. All messages that are already in the buffer are discarded.

()

Source from the content-addressed store, hash-verified

209// No more messages will be received after calling this method.
210// All messages that are already in the buffer are discarded.
211func (s *pushSubscription) Stop() {
212 if !s.closed.CompareAndSwap(false, true) {
213 return
214 }
215 s.Lock()
216 defer s.Unlock()
217 close(s.done)
218 s.subscription.Unsubscribe()
219 if s.hbMonitor != nil {
220 s.hbMonitor.Stop()
221 }
222}
223
224// Drain unsubscribes from the stream and cancels subscription.
225// All messages that are already in the buffer will be processed in callback function.

Callers 1

ConsumeMethod · 0.95

Calls 3

CompareAndSwapMethod · 0.80
UnsubscribeMethod · 0.80
StopMethod · 0.65

Tested by

no test coverage detected