---
id: bookworm.{env}.finance.complete-order
name: Order Completion Command Channel
version: 1.0.0
type: topic
summary: |
  Kafka topic owned by the contributor team carrying Finance order-completion
  commands consumed by Notification API to send completion emails.
owners:
  - commerce-fulfillment-team
badges:
  - content: Kafka
    backgroundColor: blue
    textColor: blue
  - content: Topic
    backgroundColor: teal
    textColor: teal
address: bookworm.{env}.finance.complete-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 topic transports order-completion notification commands published by [[service|order-orchestration]] after [[service|order-api]] reports that an order has completed. [[service|notification-api]] consumes these commands to render and submit a completion email when usable customer contact details are present. No delivery confirmation is returned to Finance, and this channel never mutates order state.

## Channel Specification

| Property                               | Value                                                                       |
| :------------------------------------- | :-------------------------------------------------------------------------- |
| **Bounded Context / Owner**            | [[domain\|ordering]] / [[team\|commerce-fulfillment-team]]                  |
| **Channel Type**                       | Topic                                                                       |
| **Address Pattern**                    | `bookworm.{env}.finance.complete-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]]        |

## Messages & Participants

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

## Ordering, Retries & Failure Handling

- **Partition-key ordering:** Keying by `orderId` preserves ordering for lifecycle notification commands targeting the same order.
- **Transient retries:** [[service|notification-api]] applies bounded SMTP client retries and Kafka listener cooldowns on transient mail-provider failures.
- **Immediate DLQ routing:** Malformed payloads, rendering errors, or exhausted retries route to [[channel|bookworm.&#123;env&#125;.notification.dead-letter-queue]].
- **Consumer idempotency:** [[service|notification-api]] deduplicates by message ID for 24 hours; blank email addresses are skipped safely without error, and operators must check [[service|sendgrid-api]] activity before replaying to prevent duplicate emails.

## Channel Details & Visualization

<ChannelInformation />

<NodeGraph />

## Related Documentation

- [[channel|bookworm.&#123;env&#125;.notification.dead-letter-queue]] — Consumer dead-letter queue
- [[channel|bookworm.&#123;env&#125;.ordering.order-status-change-to-complete]] — Upstream order completion event topic
- [[channel|bookworm.&#123;env&#125;.finance.cancel-order]] — Paired order cancellation command topic
- [[service|order-orchestration]] — Command producer
- [[service|notification-api]] — Email consumer
- [[flow|notification-delivery]] — Notification delivery workflow
- [[flow|order-lifecycle]] — End-to-end order lifecycle flow
- [[doc|arc42/08-crosscutting-concepts/002-contracts-and-messaging]] — Messaging standards and idempotency rules
