You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by sunil kalva <ka...@gmail.com> on 2015/12/14 13:56:13 UTC

retrieve commit time for messages

Hi
Is there any way to get the commit timestamp of the messages which are
retrieved using kafka consumer API.

t
SunilKalva

Re: retrieve commit time for messages

Posted by Jason Gustafson <ja...@confluent.io>.
At the moment, there is no direct way to do this, but you could use the
commit API to include metadata with each committed offset:

public void commitSync(final Map<TopicPartition, OffsetAndMetadata>
offsets);
public OffsetAndMetadata committed(TopicPartition partition);

The OffsetAndMetadata object contains a metadata string field which a
timestamp could be packed into. Unfortunately, this only gives you access
to the last commit. You can also consume from the __consumer_offsets topic
directly (where committed offsets are stored), but keep in mind that his
topic is periodically compacted, so you will only have a limited history of
commits available.

-Jason

On Mon, Dec 14, 2015 at 4:56 AM, sunil kalva <ka...@gmail.com> wrote:

> Hi
> Is there any way to get the commit timestamp of the messages which are
> retrieved using kafka consumer API.
>
> t
> SunilKalva
>

Re: retrieve commit time for messages

Posted by Jason Gustafson <ja...@confluent.io>.
At the moment, there is no direct way to do this, but you could use the
commit API to include metadata with each committed offset:

public void commitSync(final Map<TopicPartition, OffsetAndMetadata>
offsets);
public OffsetAndMetadata committed(TopicPartition partition);

The OffsetAndMetadata object contains a metadata string field which a
timestamp could be packed into. Unfortunately, this only gives you access
to the last commit. You can also consume from the __consumer_offsets topic
directly (where committed offsets are stored), but keep in mind that his
topic is periodically compacted, so you will only have a limited history of
commits available.

-Jason

On Mon, Dec 14, 2015 at 4:56 AM, sunil kalva <ka...@gmail.com> wrote:

> Hi
> Is there any way to get the commit timestamp of the messages which are
> retrieved using kafka consumer API.
>
> t
> SunilKalva
>