wvanbergen/kafka — pull request #11 by manygrams (2014-06-25 22:14:27+00:00)
Title: add ability to calcualte how far behind a consumer is

@wvanbergen what do you think of this instead of what we were talking about? This adds a public calculator about how far behind the current consumer is the latest events. I figured it's better to keep that out of the concerns of the program using the consumergroup.

The way I have done this will be approximate as it tracks the last heard events when the offset is committed to zookeeper. Is this okay with you? Is there a more accurate way of doing this?

This also allows anyone using this code to start a goroutine that checks this once every x seconds (which is what I'm doing).

If you think it's a good idea, I can also expose `latestOffsets`, but I figured there wouldn't be too much point.