You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by tao xiao <xi...@gmail.com> on 2015/02/16 07:50:05 UTC

Re: API to get the partition number

You can get the partition number and offset of the message by
MessageAndMetadata.partition() and MessageAndMetadata.offset().

To your scenario you can turn off auto commit auto.commit.enable=false and
then commit by yourself after finishing message consumption.

On Mon, Feb 16, 2015 at 1:40 PM, Arunkumar Srambikkal (asrambik) <
asrambik@cisco.com> wrote:

> Hi,
>
>
> Is there a way to get the current partition number and current offset,
> when using the *high level consumer* in 0.8.2?
>
> I went through the previous messages and in the previous version I think
> there are none.
>
> The reason we want to do this, is that I  plan to have a consumer without
> the default commit of offsets, to avoid the scenario of consumers going
> down before updating the accurate offset.
>
> Rgds
> Arun
>



-- 
Regards,
Tao

RE: API to get the partition number

Posted by "Arunkumar Srambikkal (asrambik)" <as...@cisco.com>.
That was exactly what I was looking for.  

Thanks
Arun

-----Original Message-----
From: tao xiao [mailto:xiaotao183@gmail.com] 
Sent: Monday, February 16, 2015 12:20 PM
To: users@kafka.apache.org
Subject: Re: API to get the partition number

You can get the partition number and offset of the message by
MessageAndMetadata.partition() and MessageAndMetadata.offset().

To your scenario you can turn off auto commit auto.commit.enable=false and then commit by yourself after finishing message consumption.

On Mon, Feb 16, 2015 at 1:40 PM, Arunkumar Srambikkal (asrambik) < asrambik@cisco.com> wrote:

> Hi,
>
>
> Is there a way to get the current partition number and current offset, 
> when using the *high level consumer* in 0.8.2?
>
> I went through the previous messages and in the previous version I 
> think there are none.
>
> The reason we want to do this, is that I  plan to have a consumer 
> without the default commit of offsets, to avoid the scenario of 
> consumers going down before updating the accurate offset.
>
> Rgds
> Arun
>



--
Regards,
Tao