Kafka enable.auto.commit = true 并且使用了 commitSync()

Kafka enable.auto.commit = true and commitSync() is used

建议仅当enable.auto.commit设置为false时才使用commitSync()。但是我们用了commitSync(),忘了把enable.auto.commit设置成false。所以我想知道在这种情况下会发生什么?

如果 enable.auto.commit is set to True then the consumer's offset are periodically committed in the background. On the other hand, commitSync() 是允许手动提交偏移量的阻塞调用。

在您的情况下,将在两种情况下提交偏移量:

  • 每次调用commitSync()

  • N 毫秒,其中 N 是一个可配置参数 (auto.commit.interval.ms)