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
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With