---
id: bookworm.{env}.basket.dead-letter-queue
name: Basket Dead Letter Queue
version: 1.0.0
type: topic
summary: |
  Kafka dead-letter topic owned by the platform team that captures Basket API
  messages after retry exhaustion or deserialization failure.
owners:
  - platform-engineering-team
badges:
  - content: Kafka
    backgroundColor: blue
    textColor: blue
  - content: Dead-Letter Queue
    backgroundColor: red
    textColor: red
address: bookworm.{env}.basket.dead-letter-queue
parameters:
  env:
    enum:
      - development
      - staging
      - production
    default: development
    examples:
      - development
      - staging
      - production
    description: BookWorm deployment environment.
deliveryGuarantee: at-least-once
protocols:
  - kafka
---

## Purpose & Scope

This dead-letter channel captures failed checkout cleanup commands that [[service|basket-api]] could not process. Messages arrive here either after bounded transient retries (such as Redis connectivity or timeout errors) are exhausted, or immediately when a record fails deserialization or schema validation as a poison message.

## DLQ Profile

| Property                          | Value                                                                                           |
| :-------------------------------- | :---------------------------------------------------------------------------------------------- |
| **Owning Service**                | [[service\|basket-api]]                                                                         |
| **Address Pattern**               | `bookworm.{env}.basket.dead-letter-queue`                                                       |
| **Upstream Source Channels**      | [[channel\|bookworm.&#123;env&#125;.finance.place-order]]                                       |
| **Routing Triggers**              | Exhausted transient retries (storage/network faults) or immediate poison/deserialization errors |
| **Retention / Inspection Window** | Governed by Kafka broker retention policy; inspect and triage before broker expiry              |
| **Replay Safety**                 | Idempotent if basket is already deleted; verify order and basket state first                    |

## Triage & Replay Guardrails

:::warning
Before replaying any record from this DLQ:

1. Verify that the corresponding order still exists and check whether the checkout saga in [[service|order-orchestration]] has already completed or compensated.
2. Confirm that Redis basket storage is healthy and whether the target basket has already been removed.
3. Isolate permanent schema or deserialization errors rather than replaying poison records.
4. **Replay only to [[service|basket-api]]** — never replay to the shared [[channel|bookworm.&#123;env&#125;.finance.place-order]] topic, as [[service|notification-api]] also consumes it and would send duplicate order emails.

Follow the operational triage procedures in [[doc|operational/003-incident-response-and-runbooks]].
:::

<Accordion title="Retention, Correlation & Consumer Isolation">
	- **Preserved metadata:** Records retain the original CloudEvents envelope, `orderId` Kafka
	partition key, and failure diagnostic headers (error reason, timestamp, and attempt count). -
	**Cross-consumer isolation:** [[service|notification-api]] failures on the same upstream topic
	route separately to [[channel|bookworm.&#123;env&#125;.notification.dead-letter-queue]].
</Accordion>

## Channel Details & Visualization

<ChannelInformation />

<NodeGraph />
