In Kafka how to get the exact offset according producing time

后端 未结 5 2231
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-04 07:58

I need to get the message produced in Kafka hour by hour in a day. Every one hour I will launch a job to consume the message produced 1 hour ago. e.g., if current time is 20:12,

5条回答
  •  忘掉有多难
    2021-02-04 08:29

    Kafka 1.10 does support timestamps, although it will still be a little challenge to use it to do what you want to do. But if you know but from which timestamp you want to read, and until you want to read, then you can just poll messages till that time, and stop consuming.

提交回复
热议问题