Bounded Context Canvas
Derived from network/model/model.yaml. This context's service is built; the model carries its as-built contracts, and identifiers (Err... names, routes, CloudEvents types) are the names the service uses.
Following the ddd-crew Bounded Context Canvas v5.
Every message row comes from contexts[customer-ordering] (inbound,
consumes, publishes, sync_calls, rest) or from a neighbour's entry
that names this context.
Canvas at a glance
Two pictures of the sections below, laid out like the ddd-crew canvas:
first the inbound collaborators feeding this context (purpose, domain roles
and the business decisions it enforces), then the outbound collaborators it
calls or notifies. Arrows follow the message type: solid blue commands
(cmd), dotted green queries (qry), thick orange events (evt);
each arrow names its channel and the messages it carries. Box shapes mark
the collaborator kind: rounded = people, UI or any client; blue = sibling
bounded context. Channel names on the arrows are abbreviated; the Inbound
and Outbound Communication tables carry the exact route, topic and
CloudEvents type for every message.
Inbound
Outbound
Derived from: model.yaml → contexts[customer-ordering].inbound,
.sync_calls, .publishes, .purpose, .roles, .business_decisions.
The diagrams omit assumptions, verification metrics, open questions and the
ubiquitous language (sections below), the relationship pattern per message
(see the tables), and the synchronous replies. RegisterShopper
(POST /shoppers) is in the model's rest list but has no inbound row;
the arrow assigns it to the storefront, which is an assumption (see Open
Questions).
Name
Customer Ordering (customer-ordering, code CO, CloudEvents tier
commerce).
Purpose
To turn a shopper's cart into a customer order. The context:
- obtains a promise from
delivery-promisefor every shipment group at checkout (MakePromise), re-quoting when the offer the shopper saw has expired (QuoteDeliveryOffers); - records the order with the shopper and the ship-to address (synthetic PII, held only here);
- publishes
CustomerOrderPlacedwith the promise snapshot of every group, soorder-sourcingdoes not have to correlate two streams; - shows status and tracking, built from fulfilment, promise and package events;
- handles customer cancellation as a request for the groups no node has locked yet.
Strategic Classification
| Axis | Verdict |
|---|---|
| Domain | Generic subdomain. See the Core Domain Chart. |
| Business Model | Engagement (the storefront transaction). |
| Evolution | Commodity. |
Domain Roles
| Role | Applies? | Evidence in the model |
|---|---|---|
| Execution (checkout) | Yes, primary | PlaceOrder, the CheckoutPromising policy, the sync calls MakePromise and QuoteDeliveryOffers. |
| Gateway (storefront) | Yes | The storefront routes POST /checkout, GET /orders/{orderId}, GET /orders/{orderId}/tracking, POST /orders/{orderId}/cancellations are the shopper's way into the network's order flow (Open Host). |
| Analysis | No | OrderTrackingView is a projection for display, not a decision. |
| Specification / Enforcer | No | Promise rules and capacity belong to delivery-promise. |
Inbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
| Shopper / storefront | PlaceOrder | Command | REST POST /checkout | Open Host |
| Shopper / storefront | CancelOrder | Command | REST POST /orders/{orderId}/cancellations | Open Host |
Shopper / storefront (assumed; no inbound row) | RegisterShopper | Command | REST POST /shoppers | Open Host |
| Shopper / storefront | GetOrder | Query | REST GET /orders/{orderId} | Open Host |
| Shopper / storefront | GetTracking | Query | REST GET /orders/{orderId}/tracking | Open Host |
shipping-and-tracking | GetShipTo | Query | REST GET /orders/{orderId}/ship-to (in-org, restricted) | Customer/Supplier (we are the Supplier) |
| Network operator | PublishNotificationPolicy | Command | REST PUT /notification-policy (the whole document; every call publishes a new version) | UI |
| Network operator | GetNotificationPolicy | Query | REST GET /notification-policy | UI |
order-sourcing | FulfillmentLocked | Event | Kafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentLocked | Conformist |
order-sourcing | FulfillmentShipped | Event | Kafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentShipped | Conformist |
order-sourcing | FulfillmentUnsourceable | Event | Kafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentUnsourceable | Conformist |
delivery-promise | PromiseAtRisk | Event | Kafka retailnetwork.delivery-promise.events, com.retailnetwork.commerce.delivery-promise.promise.PromiseAtRisk | Customer/Supplier |
delivery-promise | PromiseRevised | Event | Kafka retailnetwork.delivery-promise.events, com.retailnetwork.commerce.delivery-promise.promise.PromiseRevised | Customer/Supplier |
delivery-promise | PromiseKept | Event | Kafka retailnetwork.delivery-promise.events, com.retailnetwork.commerce.delivery-promise.promise.PromiseKept | Customer/Supplier |
delivery-promise | PromiseBroken | Event | Kafka retailnetwork.delivery-promise.events, com.retailnetwork.commerce.delivery-promise.promise.PromiseBroken | Customer/Supplier |
shipping-and-tracking | LabelIssued | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.label.LabelIssued | Conformist |
shipping-and-tracking | PackageScanned | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.journey.PackageScanned | Conformist |
shipping-and-tracking | PackageDelivered | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.journey.PackageDelivered | Conformist |
shipping-and-tracking | PackageExceptionRaised | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.journey.PackageExceptionRaised | Conformist |
Outbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
delivery-promise | QuoteDeliveryOffers | Query | REST POST /delivery-quotes (in-org) | Customer/Supplier (we are the Customer) |
delivery-promise | MakePromise | Command | REST POST /promises (in-org) | Customer/Supplier (we are the Customer) |
order-sourcing, delivery-promise | CustomerOrderPlaced | Event | Kafka retailnetwork.customer-ordering.events, com.retailnetwork.commerce.customer-ordering.customerorder.CustomerOrderPlaced | Customer/Supplier (we are the Supplier) |
order-sourcing, delivery-promise | CustomerOrderCancelled | Event | Kafka retailnetwork.customer-ordering.events, com.retailnetwork.commerce.customer-ordering.customerorder.CustomerOrderCancelled | Customer/Supplier (we are the Supplier) |
What the consumers do with them (from their own model entries):
delivery-promise confirms the provisional promise of each group
(ConfirmPromise) on CustomerOrderPlaced and cancels it (CancelPromise)
on CustomerOrderCancelled; order-sourcing queues one assignment per group
(QueueAssignment) and cancels it (CancelAssignment). Full payloads:
Domain Events. Relationship
evidence: Context Map.
Ubiquitous Language
Full glossary: Ubiquitous Language. Top terms: Shopper, Customer Order, Ship-To (PII, held only here), Checkout, Group Promise (a snapshot of the Promise), Shipment Group, Delivery Offer, Path Lock (ends customer cancellation).
Business Decisions
- No order without a promise per group. Every line is in exactly one
group and every group has a promise (
ErrLineWithoutPromise). The promise's destination postal prefix matches the ship-to (ErrPromiseDestinationMismatch). - Promise from the offer the shopper saw. If that offer has expired,
re-quote and show the new window before placing (
CheckoutPromising). The order is never placed on a window the shopper did not see. - The ship-to never leaves this context except to
shipping-and-tracking, for a label, throughGET /orders/{orderId}/ship-to. Published events carrydestinationPostalPrefixonly. - Cancel only while some group is unlocked (
ErrCancelAfterLock). After the lock, cancellation is a return. The check is advisory: a cancel is a request (every unlocked group becomesCANCELLATION_REQUESTED) andorder-sourcingdecides (FulfillmentCancelled, orFulfillmentCancelRefusedafter the lock). - Status moves forward only (
ErrStatusRegression). The order status is derived from the group states, and a late or duplicated upstream event never moves the order back: the consumer records the event and skips it. - An unfulfillable group is cancelled, not kept open. When
delivery-promisepublishesPromiseUnkeepablefor a group no node has locked, cancel that group at once, and the order if nothing remains (CancelOnUnfulfillable).FulfillmentUnsourceablealone cancels nothing.
Assumptions
delivery-promiseanswersQuoteDeliveryOffersandMakePromisewithin the checkout's request budget. Checkout has no fallback promise.delivery-promiseconsumesCustomerOrderPlacedbefore the provisional hold expires (holdExpiresAt); otherwiseConfirmPromisefails withErrPromiseHoldExpired. The outbox relay lag must stay well under the hold time.order-sourcingpublishesFulfillmentLockedfor every group it locks, so this context can enforceErrCancelAfterLockfrom local data.- Every consumed event carries
orderId, or an id this context has already linked to an order (assignmentIdfromFulfillmentLocked,promiseIdfrom checkout,trackingNumbersfromFulfillmentShipped).LabelIssuedandPackageScannedcarry noorderId. - "Restricted" on the ship-to route is enforced by network placement (the
route is not exposed through the storefront edge), because the network has
no authentication (
conventions.no_auth).
Verification Metrics
| Metric | Target (proposed) | Source |
|---|---|---|
Checkout success rate (201 / all POST /checkout) | tracked; alert on a drop | REST access log |
Share of checkouts answered 409 offer-not-quotable (offer expired, re-quoted) | below 2% | REST access log |
p95 latency of POST /checkout, including every MakePromise | below 800 ms | traces |
Placed orders whose promise was never confirmed (CustomerOrderPlaced without a matching PromiseConfirmed before holdExpiresAt) | 0 | analytics join on promiseId |
Outbox age of the oldest unpublished CustomerOrderPlaced | below 5 s | outbox_events.created_at |
ErrCancelAfterLock share of cancel requests | tracked | REST access log |
GET /orders/{orderId}/ship-to calls per LabelIssued | about 1 | access log vs consumed events |
| Ship-to fields in any published event or non-restricted response | 0 | contract test on the schemas |
| Consumer lag on the three consumed topics | below 30 s | Kafka consumer metrics |
Open Questions
- Which event drives which command? These pages use (ADR 0002 and the
consumers in the service):
FulfillmentLocked→MarkInFulfillment,FulfillmentShipped→MarkGroupShipped,PackageDelivered→MarkGroupDelivered,PackageLost/PackageReturned→MarkGroupLost/MarkGroupReturned,FulfillmentCancelled/FulfillmentCancelRefused→ConfirmGroupCancelled/RefuseGroupCancellation,PromiseRevised→UpdateGroupPromise,PromiseUnkeepable→CancelOnUnfulfillable.FulfillmentUnsourceableonly records its reason onOrderTrackingView. - Cancel wording (resolved).
business_decisionssays a customer may cancel "until every shipment group is locked"; the invariant, ADR 0002 A3 and the service act on the groups that are still unlocked, and an order with none left is refused withErrCancelAfterLock.IN_FULFILLMENT → CANCELLEDis unreachable (ADR 0002). - Group-level state (resolved).
GroupPromisealso carries the group status,tier,witnessNodeId,shipByand the lock, shipment, delivery and cancellation facts (ADR 0002 A2); the model's value-object list names only the promise fields. - Cancel racing the lock. A cancel accepted before
FulfillmentLockedarrives can meet a lockorder-sourcingalready made; itsCancelAssignmentthen fails, and the model has no compensation. - Hold expiry after placement. If
delivery-promiseconfirms too late, the promise isRELEASEDandPromiseReleasedgoes to analytics only, so this context never learns that a placed order lost its promise. - Who calls
POST /shoppers? The route andRegisterShopperexist, but noinboundrow names the caller. - Restricted without auth. How the ship-to route is restricted, given
no_auth.