liveBook · Manning

Acknowledgment

As explained in Apache Kafka in Action

An acknowledgment (ack) is a Kafka broker response indicating the configured level of message receipt or persistence.

Suppose a producer sends a price update just before a broker fails. An acknowledgment (ACK) tells the producer how far that write progressed—but what it confirms depends on the producer’s `acks` setting. Kafka uses application-level ACKs because successful network transmission alone does not establish that the message was handled as intended. section 5.0 section 5.1

Choose the confirmation point to match the cost of losing a message:

  • `acks=all` (also `acks=-1`) waits until every in-sync replica has replicated the message. It is the default and the most reliable of the three choices. section 5.1.1 section 5.4
  • `acks=1` responds when the partition leader receives the message. The response comes sooner, but the message can be lost if that leader fails before followers receive it. section 5.1.1
  • `acks=0` sends without waiting for broker confirmation. It favors performance when data loss is tolerable; it does not guarantee that a message was persisted. section 5.1.1

Configure a producer

For a price-change topic, run `kafka-console-producer.sh --topic products.prices.changelog --bootstrap-server localhost:9092 --producer-property acks=all`. Changing only `acks=all` to `acks=1` or `acks=0` changes when—or whether—the producer receives confirmation. section 5.1.1

With follower confirmation required, the leader can hold its response while it waits, then queue the response for a network thread to send. On the client side, a delivery callback can report a confirmed write; if an ACK does not arrive in time, the producer library may retry. ACKs are configured per producer, not per topic, although topic configuration also affects reliability and performance. section 8.2.2 section 8.1.1 section 5.1

Figure 5.1 Different ACK configurations. With acks=all (or acks=-1), the producer doesn’t get feedback until all in-sync replicas have replicated the message. With acks=1, the producer gets a response as soon as the leader has received the message. With acks=0, the producer sends messages and doesn’t wait for confirmation that they have actually arrived.
A group of squares with letters on them

AI-generated content may be incorrect.

Compare the leader and replica confirmation points for all three `acks` settings. section 5.1.1

An ACK setting is only part of a delivery guarantee. At-least-once delivery pairs `acks=all` with sufficient minimum in-sync replicas; exactly-once delivery additionally requires idempotence. Consumers use a different mechanism to track what they have read. section 5.4 section 5.1

How Apache Kafka in Action covers it

How deep it goes
Explains three settings, failure risks, callbacks, and broker-side waiting, without detailing consumer read tracking.
Examples
Demonstrates each setting with a console producer and shows a Python delivery callback.
What it assumes
Introduces Kafka ACKs alongside producer, leader, and replica roles; assumes no prior knowledge of application-level ACKs.
What you can do after
Operate/configure it by setting producer `acks` and interpreting which write stage an ACK confirms.
How it connects
Connects ACKs to partition leaders, in-sync replicas, replication, idempotence, and delivery guarantees.

Also explained in

Compare how 4 books explain acknowledgment →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Apache Kafka in Action. The section links point to the parts of the book it draws on.