Lag returns the lag of the last message returned by ReadMessage, or -1 if r is backed by a consumer group.
()
| 1004 | // Lag returns the lag of the last message returned by ReadMessage, or -1 |
| 1005 | // if r is backed by a consumer group. |
| 1006 | func (r *Reader) Lag() int64 { |
| 1007 | if r.useConsumerGroup() { |
| 1008 | return -1 |
| 1009 | } |
| 1010 | |
| 1011 | r.mutex.Lock() |
| 1012 | lag := r.lag |
| 1013 | r.mutex.Unlock() |
| 1014 | return lag |
| 1015 | } |
| 1016 | |
| 1017 | // SetOffset changes the offset from which the next batch of messages will be |
| 1018 | // read. The method fails with io.ErrClosedPipe if the reader has already been closed. |