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

Interface ConsumeContext

jetstream/pull.go:57–71  ·  jetstream/pull.go::ConsumeContext

ConsumeContext supports processing incoming messages from a stream. It is returned by [Consumer.Consume] method.

Source from the content-addressed store, hash-verified

55 // ConsumeContext supports processing incoming messages from a stream.
56 // It is returned by [Consumer.Consume] method.
57 ConsumeContext interface {
58 // Stop unsubscribes from the stream and cancels subscription.
59 // No more messages will be received after calling this method.
60 // All messages that are already in the buffer are discarded.
61 Stop()
62
63 // Drain unsubscribes from the stream and cancels subscription.
64 // All messages that are already in the buffer will be processed in callback function.
65 Drain()
66
67 // Closed returns a channel that is closed when the consuming is
68 // fully stopped/drained. When the channel is closed, no more messages
69 // will be received and processing is complete.
70 Closed() <-chan struct{}
71 }
72
73 // MessageHandler is a handler function used as callback in [Consume].
74 MessageHandler func(msg Msg)

Callers 20

ConsumeMethod · 0.65
NextMethod · 0.65
StopMethod · 0.65
cleanupMethod · 0.65
drainConnectionMethod · 0.65
DrainMethod · 0.65
TestEncDrainSupportedFunction · 0.65
TestDrainFunction · 0.65
TestDrainQueueSubFunction · 0.65
TestDrainUnSubsFunction · 0.65
TestDrainSlowSubscriberFunction · 0.65
TestDrainConnectionFunction · 0.65

Implementers 3

pushSubscriptionjetstream/push.go
pullSubscriptionjetstream/pull.go
orderedSubscriptionjetstream/ordered.go

Calls

no outgoing calls

Tested by

no test coverage detected