How to get data from old offset point in Kafka?

后端 未结 7 2118
别跟我提以往
别跟我提以往 2020-12-12 18:12

I am using zookeeper to get data from kafka. And here I always get data from last offset point. Is there any way to specify the time of offset to get old data?

There

7条回答
  •  隐瞒了意图╮
    2020-12-12 18:55

    Using the KafkaConsumer you can use Seek, SeekToBeginning and SeekToEnd to move around in the stream.

    https://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#seekToBeginning(java.util.Collection)

    Also, If no partition is provided, it will seek to the first offset for all of the currently assigned partitions.

提交回复
热议问题