A common use case is for calculating a "processing lag time" comparing the
record's timestamp (when it was published/persisted) against the current
time that the consumer 'consumed' it.  In theory, the delta is 'how far
behind' the consumer is, tho you can come up with a variety of reasons why
this wouldn't actually be true.

On Fri, Jan 19, 2018 at 12:52 PM, 1095193...@qq.com <1095193...@qq.com>
wrote:

> kafka  does not delete message when message is consumed, it will purge
> message when this message is expired. I guess this timeStamp is for
> checking whether message is expired.
>
>
>
> 1095193...@qq.com
>
> From: Jake Yoon
> Date: 2018-01-19 11:46
> To: users
> Subject: What's the use of timestamp in ProducerRecord?
> Hi, I am very new to Kafka.
> And I have a very basic question.
>
> Kafka doc says,
>
> *ProducerRecord
> <https://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/producer/
> ProducerRecord.html#ProducerRecord(java.lang.String,%20java.lang.Integer,%
> 20java.lang.Long,%20K,%20V)>*
> (String
> <http://docs.oracle.com/javase/7/docs/api/java/lang/
> String.html?is-external=true>
> topic, Integer
> <http://docs.oracle.com/javase/7/docs/api/java/lang/
> Integer.html?is-external=true>
> partition, Long
> <http://docs.oracle.com/javase/7/docs/api/java/lang/
> Long.html?is-external=true>
> timestamp, K
> <https://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/producer/
> ProducerRecord.html>
> key, V
> <https://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/producer/
> ProducerRecord.html>
> value)
>
> and I know the default timestamp is the current time. But I am not sure
> what's the use of it.
>
> - Is it just to log when the record is added?
> - How Kafka use it for?
> - Are there any other uses of it?
> - Can "Consumer" retrieves the timestamp of the "ProducerRecord"?
>
> Thanks,
>

Reply via email to