Skip to content
Ameen Abozaid
Planned lessonMID-028-L06

Error handling and dead-letter topics

  • Lesson 6 of 9
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

keep a poison record from blocking a partition.

Planned topics

  • An exception in a listener hits the error handler; the default DefaultErrorHandler retries with a back-off, then skips (logs).
  • Configure DeadLetterPublishingRecoverer to send failed records to <topic>.DLT.
  • Classify errors: retry transient ones (timeouts), send non-retryable ones (bad payload) straight to the DLT.
  • Non-blocking retry topics are available through @RetryableTopic (verify support for your version).
  • Monitor DLT size and keep the failure headers for diagnosis.
Draft outline details

Demonstration

java
@Bean DefaultErrorHandler errors(KafkaTemplate<Object,Object> t) {
  return new DefaultErrorHandler(new DeadLetterPublishingRecoverer(t), new FixedBackOff(1000L, 3));
}

Check your understanding

Where does a record go after retries are exhausted?

Show answer

To the dead-letter topic.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.