Kafka doesn't track per-message timestamps. The request you're using gets a
list of offsets for *log segments* with timestamps earlier than the one you
specify. If you start consuming from the offset returned, you should find
the timestamp you specified in the same log file.

-Ewen

On Mon, Aug 10, 2015 at 2:21 AM, jinhong lu <lujinho...@gmail.com> wrote:

> Hi, all
>
>     I try to use SimpleConsumer follow the example at
> https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example
> <
> https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example
> >.
>
>    I modify the offset in the code:
>         long readOffset = getLastOffset(consumer,a_topic, a_partition,
> kafka.api.OffsetRequest.EarliestTime(), clientName);
>
>   It works well when I use kafka.api.OffsetRequest.EarliestTime() or
> kafka.api.OffsetRequest.LatestTime(). But when I set it to a UNIX
> TIMESTAMP, it return not the message at that moment.
>
>    For example,
>         long readOffset = getLastOffset(consumer,a_topic, a_partition,
> 1439196000000L, clientName);
>
>   I set the timestamp to  1439196000000L, it means 2015/8/10 16:40:0. But
> it return the message about one hour before that time.
>
> (1)Is it the right way to assign the time stamp? the time stamp should be
> 13bit, not 10bit, right?
> (2)I am in china, using Beijing time, is it has an effect?
> (3) Or any possbile that kafka has any parameter to set the time of the
> cluster?
>
> thanks a lot.
>
>
> BR//lujinhong
>
>


-- 
Thanks,
Ewen

Reply via email to