liveBook · Manning

At-least-once delivery

As explained in Apache Kafka in Action

At-least-once delivery is a message delivery guarantee that prevents message loss but permits duplicate delivery.

At-least-once delivery prioritizes preventing message loss: configure a producer with acks=all and a sufficient min.insync.replicas value, such as 2. The message is replicated reliably, but a duplicate can appear if the broker stores it and the acknowledgement is lost before reaching the producer. section 5.1.3

A lost acknowledgement creates a duplicate

A producer sends a banking transaction, the broker persists it, and the acknowledgement disappears in transit. The producer retries because it cannot know whether persistence succeeded, so the transaction may be stored twice. A duplicated temperature reading may be tolerable; a duplicated debit or credit is not. section 5.1.3

Compare the delivery guarantees:

  • At-most-once uses acks=0 and prevents duplicates at the cost of possible message loss. section 5.1.3
  • At-least-once uses acks=all with sufficient in-sync replicas and accepts duplicates as the cost of avoiding loss. section 5.4
  • Exactly-once adds producer idempotence to prevent repeated messages from producing repeated effects. section 5.1.3

How Apache Kafka in Action covers it

How deep it goes
Explains configuration, acknowledgement loss, retries, and duplicates, then contrasts at-most-once and exactly-once guarantees.
Examples
Uses a lost-acknowledgement banking transaction and contrasts it with continuously produced temperature readings.
What it assumes
Assumes basic Kafka producer and broker concepts while introducing acknowledgements, in-sync replicas, retries, and delivery guarantees.
What you can do after
Operate/configure Kafka producers with acks=all and sufficient minimum in-sync replicas when duplicates are preferable to loss.
How it connects
Connects acknowledgements, replication, producer retries, at-most-once delivery, exactly-once semantics, and idempotence.

Also explained in

Compare how 4 books explain at-least-once delivery →

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.