Skip to main content

Context map

Following ddd-crew Context Mapping. This is customer-ordering's slice of the map: every relationship the code builds, with upstream (U) and downstream (D) side, the pattern and the channel. The network-wide map is in the aggregator at Context Map. Edge status (which side has code) is on Integration.

Source: internal/adapters/outbound/deliverypromise/gateway.go, internal/adapters/inbound/kafka/handlers.go, apis/asyncapi.yaml, apis/openapi.yaml, internal/adapters/inbound/mcp, and the sibling files read for Integration. Arrows point from upstream to downstream; solid is synchronous, thick is Kafka. delivery-promise appears in both directions: upstream for the checkout calls and the promise events, downstream for the order events.

Relationships​

NeighbourDirectionPatternChannelMessagesWhy this pattern
Shopper callers (checkout, storefront-bff, console remote)CO upstreamOpen Host ServiceREST POST /checkout, GET /orders..., POST /orders/{orderId}/cancellations, /shoppers...PlaceOrder, GetOrder, GetOrderTracking, CancelOrder, shopper commands and queriesMany clients use one published, versioned API (apis/openapi.yaml); none negotiates it.
delivery-promiseDP upstream, CO downstreamCustomer/Supplier (CO is the Customer)REST, DELIVERY_PROMISE_URLquote, make, confirm, cancel promiseCheckout needs an answer inside the shopper's request; DP serves this caller deliberately.
delivery-promiseCO upstream, DP downstreamCustomer/SupplierKafka retailnetwork.customer-ordering.eventsCustomerOrderPlaced, CustomerOrderCancelledDP reconciles the confirmation on placement and releases the hold on cancellation.
delivery-promiseDP upstream, CO downstreamCustomer/SupplierKafka retailnetwork.delivery-promise.eventsPromiseAtRisk, PromiseRevised, PromiseKept, PromiseBroken, PromiseUnkeepableCO keeps each group's window current and acts on PromiseUnkeepable.
order-sourcingCO upstream, OS downstreamCustomer/SupplierKafka retailnetwork.customer-ordering.eventsCustomerOrderPlaced, CustomerOrderCancelledOS queues one assignment per group from the placement; the event carries each group's promise snapshot (negotiated payload).
order-sourcingOS upstream, CO downstreamConformistKafka retailnetwork.order-sourcing.eventsFulfillmentLocked, FulfillmentShipped, FulfillmentUnsourceable, FulfillmentCancelled, FulfillmentCancelRefusedCO takes the assignment facts as published and projects them into status.
shipping-and-trackingCO upstream, ST downstreamCustomer/Supplier (ST is the Customer)REST GET /orders/{orderId}/ship-to (restricted)GetShipToThe one sanctioned read of PII outside this context, a dedicated route built for one customer.
shipping-and-trackingST upstream, CO downstreamConformistKafka retailnetwork.shipping-and-tracking.eventsLabelIssued, LabelVoided, PackageScanned, PackageDelivered, PackageExceptionRaised, PackageLost, PackageReturned, PackageEtaWindowAssigned, PackageDeliveryPointFlagged, PackageReadyForCollection, PackageCollectedPackage facts are taken as published, for status and tracking.
warehouse-ops-agent, AI agentsCO upstreamOpen Host Service (read-only)MCP Streamable HTTP, A2A JSON-RPCget_order, get_order_tracking, get_ship_toAgents read the same use cases as REST; no write tool exists.

Notes on the patterns​

  • No Anti-Corruption Layer. Every upstream is inside the same network and speaks its language; consumers read events as published (tolerant reader: unknown fields are ignored). The ACLs that exist are on the caller side (checkout's customer-ordering adapter).
  • No Shared Kernel. promiseId, assignmentId and trackingNumber are values copied from events, not shared code; deliverypromise/gateway.go restates the four routes it uses with its own DTOs.
  • No fleet edge. This context never consumes a warehouse.* topic and never calls a WMS or WES service.
  • Separate Ways with node-topology, offer-availability, vendor-connectivity, linehaul-transportation, last-mile-delivery, node-performance and seller-inbound: no edge in the code. The tracking view is event-fed; this context never calls shipping-and-tracking's journey route.
  • Other storefront contexts (pricing, shopping-cart, customer-payments, ...) have no edge with this one. The callers found in code are checkout and storefront-bff, both over REST.