Mark, The SimpleConsumer class has an API for this - getOffsetsBefore(topic, partition, time, maxNumOffsets). Using this API, you can get the offset "closest" to a particular timestamp at the log segment granularity. By log segment granularity, I mean that it doesn't poke inside a log segment and find the message right before or right after the timestamp you want.
Thus, it is just an approximation. The larger your log segment, the less accuracy you will get using this API. Thanks, Neha On Wed, Dec 7, 2011 at 7:54 AM, Mark <static.void....@gmail.com> wrote: > Is there any way to consume all messages starting at and/or between two > timestamps? >