You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Churu Tang <ct...@rubiconproject.com> on 2014/03/14 07:40:44 UTC

about offsetRequest time field

Hi,
I am building kafka client using C++ Client API. The offsetRequest API is based on 
		https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-OffsetRequest

According to the documentation, the “Time” field in offsetRequest is used to ask for all messages before a certain time (ms), special value are -1 and -2. So my understanding is, if I put “1” in the “Time” field, all offsets 1 ms ago should be retrieved. If there are 6 messages published to the partition between 1 hour ago and now(the kafka-console-consumer.sh and c++ fetchRequest are able to see those 6 messages), then I should be able to get all of those offsets. But when I tried to use 1, 10, 1000, 10000 and current epoch time as "Time" , none of those will return any offset. 

My question is, am I understanding the meaning of “Time” right? Or should I try other values for the “Time” field? Thanks for your time!

Cheers,
Churu

Re: about offsetRequest time field

Posted by Churu Tang <ct...@rubiconproject.com>.
Thanks for helping!

Cheers,
Churu
On Mar 14, 2014, at 7:42 AM, Neha Narkhede <ne...@gmail.com> wrote:

> My question is, am I understanding the meaning of "Time" right? Or should I
> try other values for the "Time" field? Thanks for your time!
> 
> The time field expects an absolute unix timestamp, except for the 2 special
> values for getting earliest and latest offsets.
> 
> Thanks
> Neha
> 
> On Thursday, March 13, 2014, Churu Tang <ct...@rubiconproject.com> wrote:
> 
>> Hi,
>> I am building kafka client using C++ Client API. The offsetRequest API is
>> based on
>> 
>> https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-OffsetRequest
>> 
>> According to the documentation, the "Time" field in offsetRequest is used
>> to ask for all messages before a certain time (ms), special value are -1
>> and -2. So my understanding is, if I put "1" in the "Time" field, all
>> offsets 1 ms ago should be retrieved. If there are 6 messages published to
>> the partition between 1 hour ago and now(the kafka-console-consumer.sh and
>> c++ fetchRequest are able to see those 6 messages), then I should be able
>> to get all of those offsets. But when I tried to use 1, 10, 1000, 10000 and
>> current epoch time as "Time" , none of those will return any offset.
>> 
>> My question is, am I understanding the meaning of "Time" right? Or should
>> I try other values for the "Time" field? Thanks for your time!
>> 
>> Cheers,
>> Churu


Re: about offsetRequest time field

Posted by Neha Narkhede <ne...@gmail.com>.
My question is, am I understanding the meaning of "Time" right? Or should I
try other values for the "Time" field? Thanks for your time!

The time field expects an absolute unix timestamp, except for the 2 special
values for getting earliest and latest offsets.

Thanks
Neha

On Thursday, March 13, 2014, Churu Tang <ct...@rubiconproject.com> wrote:

> Hi,
> I am building kafka client using C++ Client API. The offsetRequest API is
> based on
>
> https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-OffsetRequest
>
> According to the documentation, the "Time" field in offsetRequest is used
> to ask for all messages before a certain time (ms), special value are -1
> and -2. So my understanding is, if I put "1" in the "Time" field, all
> offsets 1 ms ago should be retrieved. If there are 6 messages published to
> the partition between 1 hour ago and now(the kafka-console-consumer.sh and
> c++ fetchRequest are able to see those 6 messages), then I should be able
> to get all of those offsets. But when I tried to use 1, 10, 1000, 10000 and
> current epoch time as "Time" , none of those will return any offset.
>
> My question is, am I understanding the meaning of "Time" right? Or should
> I try other values for the "Time" field? Thanks for your time!
>
> Cheers,
> Churu