---
id: bookworm.{env}.ordering.order-status-change-to-complete
name: Order Completion Event Channel
version: 1.0.0
type: topic
summary: |
  Kafka topic owned by the commerce-fulfillment-team carrying Order API events
  when an order transitions from New to Completed.
owners:
  - commerce-fulfillment-team
badges:
  - content: Kafka
    backgroundColor: blue
    textColor: blue
  - content: Topic
    backgroundColor: teal
    textColor: teal
address: bookworm.{env}.ordering.order-status-change-to-complete
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 topic transports order completion events published by [[service|order-api]] when an order transitions from `New` to `Completed`. [[service|order-orchestration]] consumes these events to advance the order saga and dispatch a completion email command to [[channel|bookworm.&#123;env&#125;.finance.complete-order]]. This event reports order status only and does not confirm email delivery.

:::note
In current payloads, the `basketId` field carries the buyer identifier rather than an independent Basket service record identifier.
:::

## Channel Specification

| Property                               | Value                                                                     |
| :------------------------------------- | :------------------------------------------------------------------------ |
| **Bounded Context / Owner**            | [[domain\|ordering]] / [[team\|commerce-fulfillment-team]]                |
| **Channel Type**                       | Topic                                                                     |
| **Address Pattern**                    | `bookworm.{env}.ordering.order-status-change-to-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 event ordering within a partition |
| **Delivery Semantics**                 | At-least-once                                                             |
| **Dead-Letter Channel**                | None (direct worker consumption by [[service\|order-orchestration]])      |

## Messages & Participants

| Message                                                 | Type  | Producer               | Consumer(s)                      | Consumer Group               |
| :------------------------------------------------------ | :---- | :--------------------- | :------------------------------- | :--------------------------- |
| [[event\|OrderStatusChangedToCompleteIntegrationEvent]] | Event | [[service\|order-api]] | [[service\|order-orchestration]] | Finance orchestration worker |

## Ordering, Retries & Failure Handling

- **Partition-key ordering:** Keying by `orderId` ensures completion events are serialized per order within a partition.
- **Transient retries:** [[service|order-orchestration]] applies bounded retry/backoff on transient orchestration host or state faults.
- **Poison & failure posture:** Direct worker consumption has no dedicated service DLQ; inspect Finance worker logs and saga state before replaying or resetting offsets.
- **Consumer idempotency:** Completed orchestration instances ignore late or duplicate completion events.

## Channel Details & Visualization

<ChannelInformation />

<NodeGraph />

## Related Documentation

- [[channel|bookworm.&#123;env&#125;.finance.complete-order]] — Downstream notification command topic
- [[channel|bookworm.&#123;env&#125;.ordering.user-checked-out]] — Upstream checkout event topic
- [[channel|bookworm.&#123;env&#125;.ordering.order-status-change-to-cancel]] — Paired cancellation event topic
- [[service|order-api]] — Order status event producer
- [[service|order-orchestration]] — Finance saga consumer
- [[flow|order-lifecycle]] — End-to-end order lifecycle flow
- [[doc|arc42/08-crosscutting-concepts/002-contracts-and-messaging]] — Messaging standards and idempotency rules
