You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Hu Xi <hu...@hotmail.com> on 2017/04/13 09:07:00 UTC

答复: Invoking KafkaConsumer#seek for the same partition

Oh My! yes, you are right. I would have been thinking it that way....  Thank you.

________________________________
发件人: Michal Borowiecki <mi...@openbet.com>
发送时间: 2017年4月13日 17:02
收件人: dev@kafka.apache.org
主题: Re: Invoking KafkaConsumer#seek for the same partition

Sounds to me the comment is imprecisely phrased but was meant to
indicate the behaviour you are describing.

Perhaps instead of "the latest offset", it should say, "the offset used
in the latest seek" to make it super-clear.

Cheers,

Michal


On 13/04/17 08:28, Hu Xi wrote:
> Hi guys,
>
>
> The comments for KafkaConsumer#seek says “If this API is invoked for the same partition more than once, the latest offset will be used on the next poll()”. However, I tried a couple of times, and it turned out that the next poll could always read records from the offset which was specified in the last call of KafkaConsumer#seek instead of the latest offset. Seems the comment is not correct.  What do you say? Any comments are welcomed.



Re: 答复: Invoking KafkaConsumer#seek for the same partition

Posted by Michal Borowiecki <mi...@openbet.com>.
But I totally agree, the comment is ambiguous.

The way it's phrased now "latest offset" can easily be taken for "the 
highest(=latest) of the offsets" rather than "the offset last-used".

Cheers,

Michal


On 13/04/17 10:07, Hu Xi wrote:
> Oh My! yes, you are right. I would have been thinking it that way....  Thank you.
>
> ________________________________
> : Michal Borowiecki <mi...@openbet.com>
> \u02b1: 2017413 17:02
> \u057c: dev@kafka.apache.org
> : Re: Invoking KafkaConsumer#seek for the same partition
>
> Sounds to me the comment is imprecisely phrased but was meant to
> indicate the behaviour you are describing.
>
> Perhaps instead of "the latest offset", it should say, "the offset used
> in the latest seek" to make it super-clear.
>
> Cheers,
>
> Michal
>
>
> On 13/04/17 08:28, Hu Xi wrote:
>> Hi guys,
>>
>>
>> The comments for KafkaConsumer#seek says If this API is invoked for the same partition more than once, the latest offset will be used on the next poll(). However, I tried a couple of times, and it turned out that the next poll could always read records from the offset which was specified in the last call of KafkaConsumer#seek instead of the latest offset. Seems the comment is not correct.  What do you say? Any comments are welcomed.
>