liveBook · Manning

Retry

As explained in Apache Kafka in Action

A retry is a technique or mechanism that repeats an operation after a failure or timeout in an attempt to complete it successfully.

When a Kafka operation fails or times out, retry repeats the send or connector operation after a delay instead of failing immediately. The Kafka producer handles retries within configured time limits, while Kafka Connect can retry access to external systems. section 8.1.3 section 11.6.2

A retry policy combines several controls:

  • The producer waits for a broker response up to request.timeout.ms, then waits retry.backoff.ms before retrying. section 8.1.3
  • delivery.timeout.ms limits the total delivery period; after it expires, the producer gives up and throws an exception. section 8.1.3
  • Kafka Connect uses errors.retry.timeout and errors.retry.delay.max.ms for failed external-system operations; connector-specific settings may add attempt counts and backoff intervals. section 11.6.2
  • Retries should not become blind application-level resends: producer-library retries preserve ordering, particularly when enable.idempotence is enabled, while a circuit breaker can intercept persistent failure. section 8.1.3

Temporary database outage

A JDBC connector normally attempts a failed database connection three times at 10-second intervals. During maintenance or a short network outage, increasing connection.attempts and connection.backoff.ms can provide more recovery time and avoid a connector restart. section 11.6.2

Figure 8.2 We can define numerous timeouts in the producer. The most important are linger.ms, which we can use to configure batching, and delivery.timeout .ms, which we can use to configure when the Kafka library stops redelivering messages and throws an error.
A close-up of a black background

AI-generated content may be incorrect.

Use the timeout diagram to relate batching delay, broker-response timeout, retry backoff, and the total delivery deadline. section 8.1.3

How Apache Kafka in Action covers it

How deep it goes
Explains retry timing, total deadlines, connector-specific attempts, ordering, and circuit-breaker handling without detailing retry implementation internals.
Examples
Uses producer timeout settings, Kafka Connect retry parameters, and JDBC connection attempts during database maintenance or network outages.
What it assumes
Assumes Kafka producer or Kafka Connect configuration concepts, including timeouts and connector settings.
What you can do after
Operate/configure Kafka retries with bounded delays, total delivery deadlines, connector attempts, and persistent-failure handling.
How it connects
Connects retries with acknowledgments, timeouts, idempotence, circuit breakers, Kafka Connect, JDBC connectors, and dead-letter queues.

Also explained in

Compare how 21 books explain retry →

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.