On this page
Kafka Improvement Proposal
KIP-1191: a dead-letter queue for share groups
KIP-1191 gives share groups a dead-letter queue. When a record is rejected or runs out of delivery attempts, the broker writes it to a dead-letter topic before archiving it, so the failed message can be inspected or replayed later instead of silently disappearing from the queue.
- Proposal
- KIP-1191, Dead-letter queues for share groups
- Status
- Shipped New in Kafka 4.4, opt-in per share group.
- Area
- Consumer groups and queues
- Proposal page
- KIP-1191 on the Apache Kafka wiki
Why it was needed
Share groups (KIP-932) stop a poison message from looping forever: after group.share.delivery.count.limit attempts, or when a consumer rejects it, the record is archived and never delivered again. But archived meant gone from the group's point of view. Every team had to build its own dead-letter handling in the consumer, which is exactly the part that tends to fail along with the processing.
What it changes
A share group can be given a dead-letter topic. When a record is rejected, or released once too often, the broker writes a dead-letter record to that topic before archiving the original. By default the dead-letter record holds only headers: the group, topic, partition, offset, delivery count and why it failed. A group setting adds a copy of the original key and value. If the write fails, for example because the topic does not exist, the record is archived anyway.
How to use it
- Set the group config errors.deadletterqueue.topic.name to the dead-letter topic; set errors.deadletterqueue.copy.record.enable=true to keep the key and value too.
- The topic name must start with the cluster prefix errors.deadletterqueue.topic.name.prefix (dlq. by default), and the topic needs errors.deadletterqueue.group.enable=true. Create it first unless errors.deadletterqueue.auto.create.topics.enable is on.
- The feature needs share.version=2 on the cluster.
Where it stands
Shipped in Apache Kafka 4.4. It is off until a group is given a dead-letter topic, and it needs the cluster on share.version=2.
What comes next
Replaying from the dead-letter topic back into the main topic is left to tools and applications for now.
See it in the simulator
- Kafka 4.4 share group dead-letter queue (KIP-1191) (Share group dead-letter queue) Step 4: Dead letter in dlq.orders Open at this step: Kafka 4.4 share group dead-letter queue (KIP-1191)
- Kafka 4.4 share group dead-letter queue (KIP-1191) (Share group dead-letter queue) Step 3: Archiving, not archived Open at this step: Kafka 4.4 share group dead-letter queue (KIP-1191)