---
id: bookworm.{env}.finance.place-order
name: Order Placement Command Channel
version: 1.0.0
type: topic
summary: |
  Shared Kafka topic owned by the contributor team carrying Finance order
  placement commands to Basket API for cleanup and Notification API for email.
owners:
  - commerce-fulfillment-team
badges:
  - content: Kafka
    backgroundColor: blue
    textColor: blue
  - content: Shared Topic
    backgroundColor: purple
    textColor: purple
address: bookworm.{env}.finance.place-order
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}.notification.dead-letter-queue
  version: 1.0.0
---

## Purpose & Scope

This shared command topic carries order-placement commands published by [[service|order-orchestration]] after checkout begins. Two independent consumers subscribe to it: [[service|basket-api]] removes the submitted basket and reports the outcome, while [[service|notification-api]] renders and submits a new-order confirmation email. Publication here does not confirm that basket cleanup or email delivery succeeded.

:::warning
**Shared Multi-Consumer Topic:** Never blindly replay messages to `bookworm.{env}.finance.place-order`. Replaying to this topic triggers _both_ [[service|basket-api]] and [[service|notification-api]] again. Use the consumer-specific dead-letter channel ([[channel|bookworm.&#123;env&#125;.basket.dead-letter-queue]] or [[channel|bookworm.&#123;env&#125;.notification.dead-letter-queue]]) when recovering a single consumer.
:::

## Channel Specification

| Property                               | Value                                                                                                                                                           |
| :------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Bounded Context / Owner**            | [[domain\|ordering]] / [[team\|commerce-fulfillment-team]]                                                                                                      |
| **Channel Type**                       | Topic                                                                                                                                                           |
| **Address Pattern**                    | `bookworm.{env}.finance.place-order`                                                                                                                            |
| **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;.notification.dead-letter-queue]] (Notification) and [[channel\|bookworm.&#123;env&#125;.basket.dead-letter-queue]] (Basket) |

## Messages & Participants

| Message                        | Type    | Producer                         | Consumer(s)                                            | Consumer Group                                         |
| :----------------------------- | :------ | :------------------------------- | :----------------------------------------------------- | :----------------------------------------------------- |
| [[command\|PlaceOrderCommand]] | Command | [[service\|order-orchestration]] | [[service\|basket-api]], [[service\|notification-api]] | Basket service consumer; Notification service consumer |

## Ordering, Retries & Failure Handling

- **Partition-key ordering:** Keying by `orderId` ensures commands for the same order stay serialized per partition across both consumer groups.
- **Transient retries:** Each consumer group manages its own bounded retry/backoff policy independently (Redis retries in Basket; SMTP retries and listener cooldowns in Notification).
- **Immediate DLQ routing:** Poison payloads, deserialization errors, or exhausted retries route independently to [[channel|bookworm.&#123;env&#125;.basket.dead-letter-queue]] or [[channel|bookworm.&#123;env&#125;.notification.dead-letter-queue]].
- **Consumer idempotency:** [[service|basket-api]] handles repeated cleanup idempotently; [[service|notification-api]] uses a 24-hour message-ID cache, though timeout reissues with a new message ID can send another email.

## Channel Details & Visualization

<ChannelInformation />

<NodeGraph />

## Related Documentation

- [[channel|bookworm.&#123;env&#125;.basket.dead-letter-queue]] — Basket consumer dead-letter queue
- [[channel|bookworm.&#123;env&#125;.notification.dead-letter-queue]] — Notification consumer dead-letter queue
- [[channel|bookworm.&#123;env&#125;.ordering.user-checked-out]] — Upstream checkout trigger topic
- [[channel|bookworm.&#123;env&#125;.basket.delete-complete]] — Basket cleanup success topic
- [[channel|bookworm.&#123;env&#125;.basket.delete-failed]] — Basket cleanup failure topic
- [[service|order-orchestration]] — Command producer
- [[service|basket-api]] — Cleanup consumer
- [[service|notification-api]] — Email consumer
- [[flow|user-checkout]] — End-to-end checkout workflow
- [[flow|notification-delivery]] — Notification delivery workflow
- [[doc|arc42/08-crosscutting-concepts/002-contracts-and-messaging]] — Messaging standards and idempotency rules
