You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 刘建刚 <li...@gmail.com> on 2019/12/31 14:37:17 UTC

How to get kafka record's timestamp in job

      In kafka010, ConsumerRecord has a field named timestamp. It is
encapsulated
in Kafka010Fetcher. How can I get the timestamp when I write a flink job?
Thank you very much.

Re: How to get kafka record's timestamp in job

Posted by David Anderson <da...@ververica.com>.
> In kafka010, ConsumerRecord has a field named timestamp. It is
encapsulated in Kafka010Fetcher.
> How can I get the timestamp when I write a flink job?

Kafka010Fetcher puts the timestamps into the StreamRecords that wrap your
events. If you want to access these timestamps, you can use a
ProcessFunction. The onElement method of a ProcessFunction is passed a
Context object with a timestamp method that returns the timestamp of the
element currently being processed.

David

On Tue, Dec 31, 2019 at 3:37 PM 刘建刚 <li...@gmail.com> wrote:

>       In kafka010, ConsumerRecord has a field named timestamp. It is encapsulated
> in Kafka010Fetcher. How can I get the timestamp when I write a flink job?
> Thank you very much.
>