liveBook · Manning

At-most-once delivery

As explained in Kafka Streams in Action, Second Edition

At-most-once delivery is a processing guarantee that avoids reprocessing by committing before processing completes, at the risk of losing records.

At-most-once delivery prioritizes avoiding duplicate processing: records are considered delivered before processing completes, so an error can cause records to be lost. section 4.2.2

Apply the guarantee at the producer or consumer boundary:

  • Set the producer to acks=0; it sends records without waiting to learn whether the broker received or appended them. section 4.2.2
  • Commit consumer offsets immediately after retrieving a batch and before processing it; a later failure will not trigger reprocessing. section 4.3.5
  • Treat the commit as the point of no return: processing failures afterward can skip records when the consumer restarts. section 4.3.5

Batch processing trade-off

A consumer polls a batch, commits its offsets, and then begins processing. If the application stops after the commit, Kafka resumes beyond that batch: duplicates are avoided, but unprocessed records are lost. section 4.3.5

Figure 4.20 Asynchronous processing with auto-committing can lead to potentially lost records.
figure

Use the diagram to trace how asynchronous processing can leave records unfinished when a commit advances the consumer position. section 4.3.5

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains producer acknowledgments, consumer commit timing, restart behavior, and asynchronous-processing hazards without developing a complete application.
Examples
Uses producer acks=0, manual batch commits, consumer restarts, and asynchronous processing as concrete cases.
What it assumes
Assumes familiarity with Kafka producers, consumers, records, offsets, polling, and application failures.
What you can do after
Operate/configure Kafka producers with acks=0 and consumers that commit offsets before processing, while recognizing the resulting loss risk.
How it connects
Contrasts at-least-once delivery and exactly-once delivery, and connects offset commits with consumer restarts and asynchronous processing.

Also explained in

Compare how 5 books explain at-most-once delivery →

Related concepts

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