---
id: bookworm.{env}.finance.delete-basket-complete
name: Successful Basket Cleanup Command Channel
version: 1.0.0
type: topic
summary: |
  Kafka topic owned by the commerce-fulfillment-team carrying Finance's successful
  basket-cleanup command consumed by Order API for operational tracking.
owners:
  - commerce-fulfillment-team
badges:
  - content: Kafka
    backgroundColor: blue
    textColor: blue
  - content: Topic
    backgroundColor: teal
    textColor: teal
address: bookworm.{env}.finance.delete-basket-complete
parameters:
  env:
    enum:
      - development
      - staging
      - production
    default: development
    examples:
      - development
      - staging
      - production
    description: BookWorm deployment environment.
deliveryGuarantee: at-least-once
protocols:
  - kafka
deadLetterChannel:
  id: bookworm.{env}.ordering.dead-letter-queue
  version: 1.0.0
---

## Purpose & Scope

This topic transports successful basket-cleanup commands published by [[service|order-orchestration]] after [[service|basket-api]] confirms checkout cleanup. [[service|order-api]] consumes this command to record the operational outcome without altering the order's business status. This channel is distinct from Basket's upstream event topic, [[channel|bookworm.&#123;env&#125;.basket.delete-complete]].

## Channel Specification

| Property                               | Value                                                                       |
| :------------------------------------- | :-------------------------------------------------------------------------- |
| **Bounded Context / Owner**            | [[domain\|ordering]] / [[team\|commerce-fulfillment-team]]                  |
| **Channel Type**                       | Topic                                                                       |
| **Address Pattern**                    | `bookworm.{env}.finance.delete-basket-complete`                             |
| **Parameters**                         | `env` (`development`, `staging`, `production`; default: `development`)      |
| **Protocol & Envelope Format**         | Kafka + CloudEvents JSON (`application/json`)                               |
| **Partition Key & Ordering Guarantee** | Keyed by `orderId`; preserves per-order command ordering within a partition |
| **Delivery Semantics**                 | At-least-once                                                               |
| **Dead-Letter Channel**                | [[channel\|bookworm.&#123;env&#125;.ordering.dead-letter-queue]]            |

## Messages & Participants

| Message                                  | Type    | Producer                         | Consumer(s)            | Consumer Group            |
| :--------------------------------------- | :------ | :------------------------------- | :--------------------- | :------------------------ |
| [[command\|DeleteBasketCompleteCommand]] | Command | [[service\|order-orchestration]] | [[service\|order-api]] | Ordering service consumer |

## Ordering, Retries & Failure Handling

- **Partition-key ordering:** Keying by `orderId` keeps cleanup outcome commands serialized per order.
- **Transient retries:** [[service|order-api]] applies bounded retries with backoff on transient database or connectivity faults.
- **Immediate DLQ routing:** Deserialization errors, poison payloads, or exhausted retries route to [[channel|bookworm.&#123;env&#125;.ordering.dead-letter-queue]].
- **Consumer idempotency:** Because [[service|order-api]] records an operational outcome without mutating order business status, duplicate delivery or replay is safe.

## Channel Details & Visualization

<ChannelInformation />

<NodeGraph />

## Related Documentation

- [[channel|bookworm.&#123;env&#125;.ordering.dead-letter-queue]] — Consumer dead-letter queue
- [[channel|bookworm.&#123;env&#125;.basket.delete-complete]] — Upstream Basket cleanup event topic
- [[channel|bookworm.&#123;env&#125;.finance.delete-basket-failed]] — Paired cleanup failure command topic
- [[service|order-orchestration]] — Command producer
- [[service|order-api]] — Outcome consumer
- [[flow|user-checkout]] — End-to-end checkout workflow
- [[doc|arc42/08-crosscutting-concepts/002-contracts-and-messaging]] — Messaging standards and idempotency rules
