我正在使用 StormConfigs startOffsetTime 作为 LatestTime 但如果风暴停止那么它就会丢失生产者产生的数据

I am using StormConfigs startOffsetTime as LatestTime but if storm is stopped then it is Losing data produced by the producer

我正在使用 KafkaProducer 将数据发送到 storm,并且在配置 spout 时我编写了以下代码。

spoutConfig.useStartOffsetTimeIfOffsetOutOfRange=true;
spoutConfig.startOffsetTime=kafka.api.OffsetRequest.LatestTime();

但问题是当我停止 Storm 应用程序(开发环境)时,storm 丢失了生产者生成的数据。 如果我使用:

spoutConfig.startOffsetTime=kafka.api.OffsetRequest.ErliestTime()

数据插入从头开始。 在这里,我不希望在 storm 停止时丢失任何数据,但 storm 应该获取 Producer 生成的所有数据。

LocalClusters 会在您每次重新启动它们时清除它们的状态(实际上每次都会设置一个新的 Zookeeper 集群)。它们用于测试,而不是生产工作负载。这就是你的 spout 重新开始的原因。