How to get kafka record's timestamp in job

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get kafka record's timestamp in job

liujiangang
      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.
Reply | Threaded
Open this post in threaded view
|

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

David Anderson-2

> 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 刘建刚 <[hidden email]> 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.