Streams重新设置为开始

Streams重新设置为开始

本文介绍了将消费者偏移量从Kafka Streams重新设置为开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Kafka流,并希望将Java的一些使用者偏移量重置为开始.KafkaConsumer.seekToBeginning(...)听起来很正确,但是我使用Kafka Streams:

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内部状态存储.

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

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

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

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

这篇关于将消费者偏移量从Kafka Streams重新设置为开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 02:58