You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Vinicius Carvalho <vi...@gmail.com> on 2013/07/15 16:47:56 UTC

Protocol:Offsetrespose

Hi there, from the docs:

"Time: Used to ask for all messages before a certain time (ms). There are
two special values. Specify -1 to receive the latest offset (this will only
ever return one offset). Specify -2 to receive the earliest available
offsets."

But when I send -1 as an offsetrequest I get this back:

Topic: myTopic
partitionId: 0
 errorCode: 0
            Offset: 6
            Offset: 0

There are 6 messages on that topic, shouldn't -1 as a time only return one
offset on the response? Any other value that I send on request, I only get
Offset: 0 as a response.

My understanding of the parameter is that -1 would fetch the latest offset
available for consumption, this topic had no message consumed so far, so
shouldn't it always return 0?

Regards
-- 
The intuitive mind is a sacred gift and the
rational mind is a faithful servant. We have
created a society that honors the servant and
has forgotten the gift.

Re: Protocol:Offsetrespose

Posted by Colin Blower <cb...@barracuda.com>.
So, thats my fault. The protocol documentation is wrong. I added that
comment in the doc.

The time -1 should specify latest offsets, which may be more than one.
While the time -2 should specify the earliest offset and only ever
return one.

I have updated the documentation. Let me know if it is more clear now.
https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-OffsetAPI

On 07/15/2013 07:47 AM, Vinicius Carvalho wrote:
> Hi there, from the docs:
>
> "Time: Used to ask for all messages before a certain time (ms). There are
> two special values. Specify -1 to receive the latest offset (this will only
> ever return one offset). Specify -2 to receive the earliest available
> offsets."
>
> But when I send -1 as an offsetrequest I get this back:
>
> Topic: myTopic
> partitionId: 0
>  errorCode: 0
>             Offset: 6
>             Offset: 0
>
> There are 6 messages on that topic, shouldn't -1 as a time only return one
> offset on the response? Any other value that I send on request, I only get
> Offset: 0 as a response.
>
> My understanding of the parameter is that -1 would fetch the latest offset
> available for consumption, this topic had no message consumed so far, so
> shouldn't it always return 0?
>
> Regards


-- 
*Colin Blower*
/Software Engineer/
Barracuda Networks Inc.
+1 408-342-5576 (o)