tulios / kafkajs

A modern Apache Kafka client for node.js
https://kafka.js.org
MIT License
3.66k stars 516 forks source link

When the KafkaJS Consumer pulls messages from Kafka #1682

Open shyswy opened 1 month ago

shyswy commented 1 month ago

I want to know when the KafkaJS Consumer pulls messages from Kafka. I assume that the KafkaJS Consumer will pull messages after committing them. ex1) After 'Auto Commit' by commitOffsetsIfNecessary() (which depends on autoCommitInterval or autoCommitThreshold) ex2) After 'Manual Commit' byconsumer.commitOffsets()

Am I right? If not, please let me know the actual process of KafkaJS's Consuming.

ari-github commented 1 month ago

From what I saw in the code, it pulls new messages after committing the old one. However, if you choose manual, even though you commit, it will wait until the processing of the messages is finished.