Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

ADR-003: Integrate through Kafka contracts correlated by Order ID

Finance exchanges environment-scoped integration messages through Kafka and partitions messages exposing OrderId by that identifier.

November 3, 2026AcceptedIntegration

1. Context & Problem

During checkout, OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs, Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs, Notification SystemSystemv1.0.0Notification SystemInternal platform system that consumes order commands, renders email templates, and submits messages over SMTP. Ownerplatform-engineering-teamDiagramOpen docs, and Finance all perform parts of the post-checkout process, yet each area must be able to evolve and deploy independently. At the same time, many customer orders run concurrently, so forcing all orders through a single sequential queue would needlessly slow down unrelated purchases.

Finance needed a clean integration approach and a stable shared identifier that connects each incoming checkout notification, its stored workflow state, and the follow-up requests it sends downstream. This retrospective Architecture Decision Record (ADR) documents the implemented messaging and correlation design.

2. Business Value

  • Parallel checkout throughput: Separate customer orders are processed independently rather than waiting behind unrelated checkouts in a single global queue.
  • Safer team autonomy: Participating services communicate through agreed public contracts instead of reading each other’s internal data stores, reducing accidental breakage when one team updates its internals.
  • Resilient customer experience: Because checkout coordination does not hold a single live request open across every downstream participant, temporary slowdowns in one downstream area do not immediately block the rest of the platform.
  • Clear operational traceability: Using the Order ID across workflow state, messages, and operational traces makes it straightforward for support and engineering teams to follow a specific purchase end to end.

3. How It Works

  1. Contract-based message exchange: Rather than reaching into another system’s private database or keeping a synchronous request open for the entire lifecycle, services publish and consume agreed integration messages on environment-isolated channels.
  2. Order-level correlation: Each checkout workflow carries the Order ID as its common tracking key. Messages for the same purchase are routed consistently within a channel based on that identifier, while different purchases run in parallel.
  3. Pass-through basket reference: Ordering supplies the basket reference on the initial checkout message, and Finance forwards that value directly to downstream participants instead of independently resolving basket ownership.
  4. Independent asynchronous completion: Sending a message hands off work to the channel; each receiving capability processes messages at its own pace and handles repeated deliveries safely.

4. Trade-offs & Lessons Learned

Alternatives Considered

  • Reading another service’s database directly: Would have avoided some message hops, but would tightly couple Finance to private data structures and bypass the ownership boundaries of Ordering and Basket.
  • Keeping the entire checkout workflow synchronous: Would have provided an immediate single request-response path, but would tie checkout progress to the availability and speed of every participant and fit poorly with independently timed outcomes.
  • Serializing all messages under a single global key: Would have forced unrelated orders to wait in one line; per-order correlation preserves independent progress across checkouts.

Operational Realities & Risks

  • Routing is per channel, not global: Grouping messages by Order ID orders traffic within a single channel partition, but it does not establish a strict global sequence across separate channels or replace database concurrency controls.
  • Publication does not equal completion: Receiving or sending a message only means the handoff occurred; downstream participants must handle asynchronous timing and possible duplicate deliveries.
  • Contract discipline is essential: Producers and schema updates must preserve the Order identifier; messages missing that identifier will not receive key-based routing. Similarly, Ordering’s current mapping supplies the buyer identifier as the basket reference, which Finance passes through unchanged.
  • Environment isolation is necessary but not sufficient: Keeping channels scoped by environment prevents cross-environment traffic leakage, though teams still need consistent deployment and consumer configuration across environments.

5. Technical Reference

Integration Configuration & Contracts

  • Transport & discovery: Finance exchanges integration events and commands over Kafka using contracts discovered from Finance’s assembly and topic ownership attributes.
  • Partitioning rule: Configured via MessagePartitioning.ByPropertyNamed("OrderId"), routing messages that expose OrderId by that identifier within a Kafka topic.
  • Contract specifications: Payload schemas and send/receive directions are documented in the Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs AsyncAPI specification.
  • Mapped field note: The current Ordering mapper supplies Buyer ID as basketId; Finance forwards the received basketId value rather than resolving a basket independently.

Key Channels & Contracts

RoleTargetNotes
Inbound checkout topicUser Checkout Event ChannelChannelv1.0.0User Checkout Event ChannelKafka topic owned by the commerce-fulfillment-team carrying Order API checkout events that initiate Finance post-checkou...Ownercommerce-fulfillment-teamOpen docsCarries checkout integration events into Finance.
Outbound placement topicOrder Placement Command ChannelChannelv1.0.0Order Placement Command ChannelShared Kafka topic owned by the contributor team carrying Finance order placement commands to Basket API for cleanup and...Ownercommerce-fulfillment-teamOpen docsCarries Finance placement commands to downstream consumers.
Partitioning propertyOrderIdRequired on messages relying on key-based partitioning.