liveBook · Manning

Dead letter queue

As explained in Kafka Streams in Action, Second Edition

A dead letter queue is a Kafka topic that stores records a connector cannot deliver or process successfully.

A dead-letter queue (DLQ) is a Kafka topic where Kafka Connect sets aside records that a sink connector cannot deliver or process successfully. It lets the connector continue running while failed records remain available for investigation. section 5.5

Configure a DLQ alongside error handling in a sink connector:

  • Set errors.tolerance to all so the connector continues through conversion, transformation, and sink-write errors. section 5.5
  • Name the DLQ topic with errors.deadletterqueue.topic.name. section 5.5
  • Enable context headers to preserve the reason for failure; storing the failed record alone does not explain the error. section 5.5
  • Set the DLQ topic replication factor to 1 in a single-broker development cluster, or the connector may fail to start. section 5.5
Listing 5.4 REST call to install an elastic connector
$ curl -i -X PUT localhost:8083/connectors/
    student-info-elasticsearch-connector/config \
    -H "Content-Type: application/json" \
    -d ‘{
            "connector.class":
         "io.confluent.connect.elasticsearch.ElasticsearchSinkConnector",
            "connection.url": "http://elasticsearch:9200",
            "tasks.max": "1",
            "topics": "postgres_orientation_students",  #1
            "type.name": "_doc",
            "value.converter": "org.apache.kafka.connect.json.JsonConverter",
            "value.converter.schemas.enable": "false",
            "schema.ignore": "true",
            "key.ignore": "false",
            "errors.tolerance":"all",  #2
            "errors.deadletterqueue.topic.name":"orientation_student_dlq",  #3
            "errors.deadletterqueue.context.headers.enable": "true", #4
            "errors.deadletterqueue.topic.replication.factor": "1"  #5

        }’

Inspect the Elasticsearch sink connector configuration that enables error tolerance, names the DLQ topic, and preserves failure context in headers. section 5.5

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Configures tolerance, topic naming, headers, and replication, but does not detail DLQ consumption or replay procedures.
Examples
Uses an Elasticsearch sink connector writing failed records to the orientation_student_dlq topic.
What it assumes
Assumes familiarity with Kafka Connect sink connectors, topics, connector errors, and record headers.
What you can do after
Operate/configure a Kafka Connect sink connector with continued processing and diagnosable failed records.
How it connects
Connects Kafka Connect, sink connectors, error tolerance, record headers, and external systems.

Also explained in

Compare how 4 books explain dead letter queue →

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.