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

Method Drain

jetstream/push.go:226–237  ·  view source on GitHub ↗

Drain unsubscribes from the stream and cancels subscription. All messages that are already in the buffer will be processed in callback function.

()

Source from the content-addressed store, hash-verified

224// Drain unsubscribes from the stream and cancels subscription.
225// All messages that are already in the buffer will be processed in callback function.
226func (s *pushSubscription) Drain() {
227 if !s.closed.CompareAndSwap(false, true) {
228 return
229 }
230 s.Lock()
231 defer s.Unlock()
232 close(s.done)
233 s.subscription.Drain()
234 if s.hbMonitor != nil {
235 s.hbMonitor.Stop()
236 }
237}
238
239// Closed returns a channel that is closed when consuming is
240// fully stopped/drained. When the channel is closed, no more messages

Callers

nothing calls this directly

Calls 3

CompareAndSwapMethod · 0.80
DrainMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected