---
id: bookworm.{env}.ordering.dead-letter-queue
name: Ordering Dead Letter Queue
version: 1.0.0
type: topic
summary: |
  Kafka dead-letter topic owned by the platform-engineering-team that captures
  basket-cleanup outcome commands that Order API could not process.
owners:
  - platform-engineering-team
badges:
  - content: Kafka
    backgroundColor: blue
    textColor: blue
  - content: Dead-Letter Queue
    backgroundColor: red
    textColor: red
address: bookworm.{env}.ordering.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 Finance basket-cleanup outcome commands that [[service|order-api]] could not process. Messages arrive here when transient database or service faults exhaust retries, or immediately when a command fails deserialization or validation.

## DLQ Profile

| Property                          | Value                                                                                                                                    |
| :-------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- |
| **Owning Service**                | [[service\|order-api]]                                                                                                                   |
| **Address Pattern**               | `bookworm.{env}.ordering.dead-letter-queue`                                                                                              |
| **Upstream Source Channels**      | [[channel\|bookworm.&#123;env&#125;.finance.delete-basket-complete]], [[channel\|bookworm.&#123;env&#125;.finance.delete-basket-failed]] |
| **Routing Triggers**              | Exhausted transient retries (database/service faults) or immediate poison/deserialization errors                                         |
| **Retention / Inspection Window** | Governed by Kafka broker retention policy; inspect and triage before broker expiry                                                       |
| **Replay Safety**                 | Idempotent for cleanup-complete; requires manual validation for cleanup-failed (soft-deletes order)                                      |

## Triage & Replay Guardrails

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

1. Distinguish between [[command|DeleteBasketCompleteCommand]] (records operational outcome without changing order state) and [[command|DeleteBasketFailedCommand]] (soft-deletes the order record).
2. Inspect the current order state in [[service|order-api]] before replaying a failure command to ensure soft-deletion is still the intended compensation.
3. Confirm database connectivity and isolate any malformed poison records before replaying valid messages.

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

<Accordion title="Retention & Correlation Notes">
	- **Preserved metadata:** Records retain the `orderId` Kafka partition key, CloudEvents envelope,
	and failure context. - **Missing order handling:** If an order has already been removed, replaying
	a cleanup-failed command is a safe no-op.
</Accordion>

## Channel Details & Visualization

<ChannelInformation />

<NodeGraph />
