@@ -33,12 +33,11 @@ type (
3333 // MessagesContext supports iterating over a messages on a stream.
3434 // It is returned by [Consumer.Messages] method.
3535 MessagesContext interface {
36- // Next retrieves next message on a stream. It will block until the next
37- // message is available. If the context is canceled, Next will return
38- // ErrMsgIteratorClosed error. An optional timeout or context can be
39- // provided using NextOpt options. If none are provided, Next will block
40- // indefinitely until a message is available, iterator is closed or a
41- // heartbeat error occurs.
36+ // Next retrieves next message on a stream. If MessagesContext is closed
37+ // (either stopped or drained), Next will return ErrMsgIteratorClosed
38+ // error. An optional timeout or context can be provided using NextOpt
39+ // options. If none are provided, Next will block indefinitely until a
40+ // message is available, iterator is closed or a heartbeat error occurs.
4241 Next (opts ... NextOpt ) (Msg , error )
4342
4443 // Stop unsubscribes from the stream and cancels subscription. Calling
@@ -589,9 +588,11 @@ var (
589588 errDisconnected = errors .New ("disconnected" )
590589)
591590
592- // Next retrieves next message on a stream. It will block until the next
593- // message is available. If the context is canceled, Next will return
594- // ErrMsgIteratorClosed error.
591+ // Next retrieves next message on a stream. If MessagesContext is closed
592+ // (either stopped or drained), Next will return ErrMsgIteratorClosed
593+ // error. An optional timeout or context can be provided using NextOpt
594+ // options. If none are provided, Next will block indefinitely until a
595+ // message is available, iterator is closed or a heartbeat error occurs.
595596func (s * pullSubscription ) Next (opts ... NextOpt ) (Msg , error ) {
596597 var nextOpts nextOpts
597598 for _ , opt := range opts {
0 commit comments