将消费者偏移重置为Kafka Streams的开头(Reset consumer offset to the beginning from Kafka Streams)

编程入门 行业动态 更新时间:2024-10-26 02:25:48
将消费者偏移重置为Kafka Streams的开头(Reset consumer offset to the beginning from Kafka Streams)

我正在使用Kafka流,并希望将一些消费者偏移从Java重置为开头。 KafkaConsumer.seekToBeginning(...)听起来是正确的事情,但我与Kafka Streams合作:

KafkaStreams streams = new KafkaStreams(builder, props); ... streams.start();

我想这取决于具体的流管道我定义这将在引擎盖下创建几个消费者。 我可以访问这些吗? 或者是否有其他方法以编程方式重置偏移?

I am using Kafka streams and want to reset some consumer offset from Java to the beginning. KafkaConsumer.seekToBeginning(...) sounds like the right thing to do, but I work with Kafka Streams:

KafkaStreams streams = new KafkaStreams(builder, props); ... streams.start();

I guess that depending on the concrete streams pipeline I define this would create several consumers under the hood. Can I get access to those? Or is there some other way to reset offsets programmatically?

最满意答案

由于您使用的是Kafka Streams,因此您不仅要重置消费者偏移,还要重置Streams内部状态存储。

幸运的是,Kafka提供了一个Streams应用程序重置工具。

请参阅https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams+Application+Reset+Tool

Since you are using Kafka Streams you will want to reset not only the consumer offsets but also the Streams internal state store.

Fortunately there is a Streams Application Reset Tool provided with Kafka.

See https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams+Application+Reset+Tool

更多推荐

本文发布于:2023-08-03 12:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1389370.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:开头   消费者   Streams   Kafka   beginning

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!