MCPcopy
hub / github.com/segmentio/kafka-go / Lag

Method Lag

reader.go:1006–1015  ·  view source on GitHub ↗

Lag returns the lag of the last message returned by ReadMessage, or -1 if r is backed by a consumer group.

()

Source from the content-addressed store, hash-verified

1004// Lag returns the lag of the last message returned by ReadMessage, or -1
1005// if r is backed by a consumer group.
1006func (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.

Callers 2

testReaderLagFunction · 0.80

Calls 1

useConsumerGroupMethod · 0.95

Tested by 2

testReaderLagFunction · 0.64