liveBook · Manning

Retry

As explained in Kafka for Architects

A retry is a configured or performed subsequent attempt to complete an operation after a transient failure.

A retry is a subsequent attempt to complete a producer operation after a transient failure or missing acknowledgment. Kafka resends an unacknowledged batch according to the producer’s retries setting. section 3.2.5

Retries are bounded by timeout settings rather than necessarily by a small retry count. delivery.timeout.ms limits the complete send cycle, including retries and acknowledgment waits; request.timeout.ms limits each individual request. section 3.2.5 section 3.2.5

Design retries with their operational consequences in mind:

  • Treat lost acknowledgments as a duplicate-risk scenario: a broker may have written the batch before the producer retries it. section 3.2.5
  • Protect partition order when retries overlap. A later batch can be acknowledged before an earlier batch is resent, causing out-of-order storage. section 3.2.5 section 7.4.1
  • Use producer idempotence with positive retries and acks=all; recent Kafka versions also recommend no more than five in-flight requests per connection. section 7.4.1

Lost acknowledgment

A producer sends batch 1, receives no acknowledgment, and sends batch 2. If batch 2 succeeds first and batch 1 is later retried, partition order can change. Idempotence lets the broker use producer identifiers and per-partition sequence numbers to reject out-of-sequence writes for retry. section 7.4.1

How Kafka for Architects covers it

How deep it goes
Explains retry counts, delivery and request timeouts, duplicate risk, reordering, and idempotent sequencing without implementation walkthroughs.
Examples
Uses lost acknowledgments and batches 1 and 2 to show duplicate and out-of-order delivery risks.
What it assumes
Assumes familiarity with Kafka producers, batches, acknowledgments, and partitions while defining retry behavior and its risks.
What you can do after
Configure Kafka producer retries with timeout boundaries and idempotence safeguards for duplicate-free, ordered partition writes.
How it connects
Connects retries with acknowledgments, timeouts, batching, idempotence, message ordering, and partitions.

Also explained in

Compare how 21 books explain retry →

Related concepts

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