Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka Acknowledgment vs Kafka commit

What is the difference between Kafka Acknowledgment and Kafka consumer commitSync ()

Both are used for purpose of manual offset management, and hope both works Synchronously.

Please assist

like image 463
Arpit Saklecha Avatar asked Jan 22 '20 16:01

Arpit Saklecha


People also ask

What is Kafka Acknowledgement?

Once the messages are processed, consumer will send an acknowledgement to the Kafka broker. Once Kafka receives an acknowledgement, it changes the offset to the new value and updates it in the Zookeeper.

What is a Kafka commit?

When a Reactive Messaging Message processing completes, it acknowledges the message. In the case of processing failures, it sends a negative acknowledgment. The Kafka connector receives these acknowledgments and can decide what needs to be done, basically: to commit or not to commit.

What is manual commit in Kafka?

When you consume from one topic, if that consumers belongs to one consumer group, Kafka will make sure one partition consumed by one consumer. So if you commit manually it will not affect to other consumers because they consuming from another partition. But if you compare same partition consumer with enable.

What is asynchronous commit in Kafka?

Asynchronous Commits. Each call to the commit API results in an offset commit request being sent to the broker. Using the synchronous API, the consumer is blocked until that request returns successfully.


1 Answers

When using spring-kafka, the Acknowledgment is an abstraction over the detailed consumer API for committing offsets.

When you call acknowledgement.acknowledge(); the action depends on configuration. With AckMode.MANUAL, the commit is queued for the consumer to process later; with MANUAL_IMMEDIATE, commitSync() (default, or async, depending on configuration) is called immediately.

like image 75
Gary Russell Avatar answered Sep 18 '22 07:09

Gary Russell