kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ewen Cheslack-Postava <e...@confluent.io>
Subject Re: How to read messages from Kafka by specific time?
Date Mon, 10 Aug 2015 19:03:18 GMT
You can use SimpleConsumer.getOffsetsBefore to get a list of offsets before
a Unix timestamp. However, this isn't per-message. The offests returned are
for the log segments stored on the broker, so the granularity will depend
on your log rolling settings.

-Ewen

On Wed, Aug 5, 2015 at 2:11 AM, shahab <shahab.mokari@gmail.com> wrote:

> Hi,
>
> Probably this question has been already asked before, but I couldn't find
> it,
>
> I would like to fetch data from kafka by timestamp, and according to Kafk
> FAQ (
>
> https://cwiki.apache.org/confluence/display/KAFKA/FAQ#FAQ-HowdoIaccuratelygetoffsetsofmessagesforacertaintimestampusingOffsetRequest
> ?)
> "Kafka allows querying offsets of messages by time", I tried to use
> UnixTimeStamp instead  in the offset request, but every time I got an empty
> array, simply it didn't work.
>
> Based on my google search this is not possible, but Kafka FAQ states that
> this is possible!
> Does any one know how to do this? I do appreciate it.
>
> best,
> /Shahab
>



-- 
Thanks,
Ewen

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message