Scenario 22.1.10 · Share group dead-letter queue
Kafka 4.4 share group dead-letter queue (KIP-1191)
The poison pill from 22.1.5 is no longer just skipped: Kafka 4.4 writes it to the dead-letter topic dlq.orders before archiving it (KIP-1191).
Run this scenario in the playgroundCluster ready · idle. t+0.000s
Three orders go to the one partition of orders. Share group sg1 (one consumer w1, explicit acks, delivery limit 3) has a dead-letter topic: errors.deadletterqueue.topic.name=dlq.orders. Press ▶.
Open at this step: step 1, Cluster ready · idlePoison redelivered. t+1.300s
w1 acknowledged offsets 1 and 2 but never offset 0, so its acquisition lock keeps expiring and the record is redelivered. Its delivery count is now 2 of 3.
Open at this step: step 2, Poison redeliveredArchiving, not archived. t+2.300s
The lock expired again with the delivery count at the limit (3). Because the group has a dead-letter topic, offset 0 goes ARCHIVING instead of ARCHIVED, and SPSO stays at 0 while the broker writes it to dlq.orders.
Open at this step: step 3, Archiving, not archivedDead letter in dlq.orders. t+2.400s
The broker wrote offset 0 to dlq.orders partition 0 at offset 0: no key or value, only __dlq.errors headers naming group sg1, topic orders, partition 0, offset 0, delivery count 3 and the reason, Offset delivery count exceeded the threshold. Only then is it ARCHIVED, and SPSO moves to 3.
Open at this step: step 4, Dead letter in dlq.ordersWhat you start with
Kafka 4.4 adds dead-letter queues to share groups (KIP-1191; a new 4.4 cluster has the feature level it needs, share.version=2). The group sets errors.deadletterqueue.topic.name=dlq.orders, and dlq.orders was created up front with errors.deadletterqueue.group.enable=true, since the broker creates a missing dead-letter topic only when errors.deadletterqueue.auto.create.topics.enable is on. Offset 0 is a poison pill: w1 never acknowledges it, so its acquisition lock expires and it is redelivered until its delivery count reaches the limit (3), as in 22.1.5. Then the broker does not archive it straight away: the record goes ARCHIVING, the broker writes it to dlq.orders, and only then is it ARCHIVED.
Step by step
- Cluster ready · idle t+0.000s Three orders go to the one partition of orders. Share group sg1 (one consumer w1, explicit acks, delivery limit 3) has a dead-letter topic: errors.deadletterqueue.topic.name=dlq.orders. Press ▶. Open at this step: step 1, Cluster ready · idle
- Poison redelivered t+1.300s w1 acknowledged offsets 1 and 2 but never offset 0, so its acquisition lock keeps expiring and the record is redelivered. Its delivery count is now 2 of 3. Open at this step: step 2, Poison redelivered
- Archiving, not archived t+2.300s The lock expired again with the delivery count at the limit (3). Because the group has a dead-letter topic, offset 0 goes ARCHIVING instead of ARCHIVED, and SPSO stays at 0 while the broker writes it to dlq.orders. Open at this step: step 3, Archiving, not archived
- Dead letter in dlq.orders t+2.400s The broker wrote offset 0 to dlq.orders partition 0 at offset 0: no key or value, only __dlq.errors headers naming group sg1, topic orders, partition 0, offset 0, delivery count 3 and the reason, Offset delivery count exceeded the threshold. Only then is it ARCHIVED, and SPSO moves to 3. Open at this step: step 4, Dead letter in dlq.orders
The takeaway
With a dead-letter topic the delivery count limit no longer loses the poison pill: the record still leaves the queue so offsets 1 and 2 drain past it, but a copy waits in dlq.orders with headers naming the group, topic, partition, offset, delivery count and why it failed. Set errors.deadletterqueue.copy.record.enable=true to copy the key and value too. A missing or misconfigured dead-letter topic fails the write, and the record is archived anyway.
Configs in this scenario
-
errors.The dead-letter topic of a share group, new in Kafka 4.4: a record the consumer rejects, or one that reaches the delivery count limit, is written there before it is archived (empty by default, meaning no dead-letter queue).deadletterqueue. topic. name -
errors.A topic config that lets share groups write dead letters to the topic (default false); a dead-letter write to a topic without it fails, and the record is archived anyway.deadletterqueue. group. enable -
errors.Whether the broker creates a missing share-group dead-letter topic itself, with errors.deadletterqueue.group.enable=true (default false, so the topic has to exist first).deadletterqueue. auto. create. topics. enable -
errors.Whether a share-group dead-letter record also copies the original key and value (default false, so it carries only headers naming the group, topic, partition, offset and delivery count).deadletterqueue. copy. record. enable
Embed this scenario
Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.
<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=22.1.10" title="Kafka Simulator: Share group dead-letter queue" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/share-group-dead-letter-queue/">Kafka 4.4 share group dead-letter queue (KIP-1191)</a></p> Further reading
KIP-1191 on the Apache Kafka wiki
Kafka proposals behind this scenario
More in Share groups
- Kafka share groups: queue semantics with KIP-932
- More Kafka consumers than partitions with share groups
- Kafka share group acquisition lock timeout and redelivery
- Kafka share consumer acknowledge: accept, release, reject
- Kafka share group poison pill: delivery limit and archiving
- Kafka share.acknowledgement.mode: implicit vs explicit
- Kafka share.acquire.mode: batch_optimized vs record_limit
- Renew a Kafka share group acquisition lock (KIP-1222)
- Kafka share group lag: SPSO, SPEO and the acked prefix