enable.auto.commit 值未配置为 true

Red*_*dra 3 apache-kafka kafka-consumer-api apache-kafka-streams

根据 Kafka 文档,消费者配置 enable.auto.commit 的默认值为 true。但我越来越假了。

在我的 Kafka 流应用程序中,我尝试将其更改trueprops.put(StreamsConfig.consumerPrefix(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG), true)自动提交偏移量。但是我WARN o.a.k.s.StreamsConfig [main] Unexpected user-specified consumer config: enable.auto.commit found. User setting (true) will be ignored and the Streams default setting (false) will be used在日志中收到消息并恢复为 false。

原因是什么?请帮我。

Mic*_*son 6

Kafka Streams 不允许用户设置enable.auto.commit. Streams 使用自己的机制来提交偏移量,而不是依赖于消费者自动提交功能。这是为了确保提交仅在库确定不会丢失数据的特定时间点进行。

您可以控制的唯一提交设置是commit.interval.ms.