ConsumeContext supports processing incoming messages from a stream. It is returned by [Consumer.Consume] method.
| 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) |
no outgoing calls
no test coverage detected