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 maps to an inbound, rest, publishes, consumes or
sync_calls entry of contexts[shipping-and-tracking] in model.yaml, or to
the matching entry of the neighbour.
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 or any client; blue = sibling bounded
context; grey = this context's own scheduler; dashed = a caller the model
does not name, or events with no in-org consumer. Channel names on the arrows
are abbreviated (REST, Kafka); the Inbound and Outbound Communication tables
carry the exact route, topic and CloudEvents type for every message.
Inbound
Derived from: model.yaml → contexts[shipping-and-tracking].inbound, .consumes, .rest, .roles, .business_decisions, .policies (details below).
Outbound
Derived from: model.yaml → contexts[shipping-and-tracking].inbound,
.rest, .publishes, .consumes, .sync_calls, .roles,
.business_decisions, .policies; and the Inbound and Outbound
Communication tables below. 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 reply
POST /labels returns to vendor-connectivity. All Kafka topics are
retailnetwork.<producer>.events.
Name
Shipping & Tracking (shipping-and-tracking, code ST, CloudEvents
tier logistics).
Purpose
To issue the shipping label for every package and to own each package's journey. The context:
- issues a label with a network-wide unique tracking number when
vendor-connectivityasks for one in-org; - reads the ship-to address from
customer-orderingat that moment and keeps only an encrypted snapshot needed to print it; - consolidates the vendor's shipment confirmation, the pickup scan, linehaul load departures and arrivals, and last-mile out-for-delivery and attempt facts into one customer-visible, forward-only timeline;
- ends that timeline in delivered, returned or lost, and raises an exception when a package goes silent.
It is the only context outside customer-ordering that ever sees a ship-to
address (ADR 0006). It publishes no address.
Strategic Classification
| Axis | Verdict |
|---|---|
| Domain | Generic Subdomain (classification: Generic). See Core Domain Chart. |
| Business Model | Compliance / experience (labels and the tracking timeline). |
| Evolution | Commodity. A candidate to buy rather than build, behind an ACL that keeps the published event names. |
Domain Roles
| Role | Applies? | Evidence |
|---|---|---|
| Execution (labels) | Yes | ShippingLabel with IssueLabel and VoidLabel; uniqueness of (poNumber, packageNo) and of trackingNumber. |
| Analysis (timeline) | Yes | PackageJourney turns five foreign event types into one state machine; HandoverOnFirstScan and ExceptionOnSilence derive facts nobody else publishes. |
| Gateway | No | It guards PII but translates no external model. The vendor reaches it only through vendor-connectivity. |
| Specification | No | It declares nothing other contexts plan against. |
Inbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
vendor-connectivity | IssueLabel | Command | REST POST /labels (in-org) | Customer/Supplier (vendor-connectivity is the Customer) |
customer-returns | IssueReturnLabel | Command | REST POST /return-labels (in-org, service ADR 0017) | Customer/Supplier (customer-returns is the Customer) |
vendor-connectivity | VendorShipmentConfirmed | Event | Kafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.VendorShipmentConfirmed | Customer/Supplier (this context is the Customer) |
linehaul-transportation | LoadDeparted | Event | Kafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.load.LoadDeparted | Conformist |
linehaul-transportation | LoadArrived | Event | Kafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.load.LoadArrived | Conformist |
last-mile-delivery | PackageOutForDelivery | Event | Kafka retailnetwork.last-mile-delivery.events, com.retailnetwork.logistics.last-mile-delivery.route.PackageOutForDelivery | Conformist |
last-mile-delivery | DeliveryAttempted | Event | Kafka retailnetwork.last-mile-delivery.events, com.retailnetwork.logistics.last-mile-delivery.route.DeliveryAttempted | Conformist |
offer-availability | CatalogItemCreated | Event | Kafka retailnetwork.offer-availability.events, com.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemCreated | Conformist |
Shopper / customer-ordering | GetJourney | Query | REST GET /journeys/{trackingNumber} | Open Host |
| Not named in the model | RecordScan | Command | REST POST /journeys/{trackingNumber}/scans | Not modelled (Open Questions) |
| Not named in the model | VoidLabel | Command | REST POST /labels/{labelRef}/voids | Not modelled (Open Questions) |
| Itself (silence sweep) | RaiseException | Command | internal scheduler (ExceptionOnSilence) | Internal |
Outbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
customer-ordering | GetShipTo | Query (sync) | REST GET /orders/{orderId}/ship-to (in-org, restricted) | Customer/Supplier (this context is the Customer) |
linehaul-transportation, customer-ordering | LabelIssued | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.label.LabelIssued | Conformist downstream |
customer-ordering, linehaul-transportation | LabelVoided | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.label.LabelVoided | Conformist downstream |
customer-ordering | PackageScanned | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.journey.PackageScanned | Conformist downstream |
node-performance | PackageHandedOver | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.journey.PackageHandedOver | Conformist downstream |
delivery-promise, order-sourcing, customer-ordering | PackageDelivered | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.journey.PackageDelivered | Conformist downstream |
delivery-promise, customer-ordering | PackageExceptionRaised | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.journey.PackageExceptionRaised | Conformist downstream |
delivery-promise, customer-ordering | PackageReturned | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.journey.PackageReturned | Conformist downstream |
delivery-promise, customer-ordering | PackageLost | Event | Kafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.journey.PackageLost | Conformist downstream |
Full message details: Domain Events. Relationship evidence: Context Map.
Ubiquitous Language
Full glossary: Ubiquitous Language.
Top terms: Tracking Number, Shipping Label (≠ the Vendor API
Label), Package Journey, Scan, Handover (≠
VendorShipmentConfirmed), ship-to snapshot.
Business Decisions
- A tracking number is unique network-wide and is issued once per
package (
ErrLabelAlreadyIssued,ErrTrackingNumberTaken). - The address is fetched from
customer-orderingat issue time and never published. Only the encrypted snapshot needed to print is kept, for 30 days after the journey closes. No event, response or read model carries it. What leaves is an opaquestopKeyand a postal prefix onLabelIssued; no address route is built (policyNoAddressRoute). - The journey only moves forward. A duplicate scan is refused
(
ErrDuplicateScan); an out-of-order scan is stored, not applied (ErrScanOutOfOrder);DELIVERED,RETURNED,LOSTandVOIDEDare terminal (ErrJourneyClosed, checked before the duplicate-scan check). - Handover is the network's observation. The first pickup-load
departure scan at the vendor node is the handover instant
(
HandoverOnFirstScan), not the vendor'sVendorShipmentConfirmed. - Silence is an exception. No scan within the expected leg time plus a
tolerance raises
PackageExceptionRaisedwith reasonNO_SCAN(ExceptionOnSilence).
Assumptions
vendor-connectivityasks for a label only for anACCEPTEDpurchase order (its ownErrLabelBeforeAcceptance); this context does not re-check.customer-orderinganswersGetShipToinside the label request. If it does not, no label is issued.- Every tracking number on a load or route is one this context issued.
- The scan time a producer reports (
departedAt,arrivedAt,at,shippedAt) is the time order the journey applies. Kafka order across topics is not. - A
LoadDepartedwhosedepartureKindisPICKUPis that package's pickup departure at the vendor node. Without a kind, the event counts as a pickup only while the journey is stillLABELLED.
Verification Metrics
- Label issue latency p95, including
GetShipTo, and the share of label requests failed because the ship-to was unavailable. - Zero ship-to fields in any published
dataschemaand any response schema (a contract test overapis/shipping-and-tracking/openapi.yamland the eight event schemas). ErrScanOutOfOrderandErrDuplicateScanper 1,000 scans, by producer.- Share of journeys that reach a terminal state, and the share still
LABELLEDa set time afterVendorShipmentConfirmed. PackageExceptionRaised(NO_SCAN) per 1,000 packages, and the share followed by a scan within the next leg (false alarms).- Consumer lag on the five consumed topics;
PackageDeliveredpublish delay afterDeliveryAttempted(it bounds how fast promises are judged).
Open Questions
These come from gaps in model.yaml. They are listed for the model owner
and are not resolved on these pages.
- Who calls
RecordScanandVoidLabelover REST? The routes exist (POST /journeys/{trackingNumber}/scans,POST /labels/{labelRef}/voids); no inbound row or neighboursync_callsentry names a caller. - What does
IssueLabelcarry?GetShipToneeds anorderId, andPackageDeliveredpublishes one, butLabelIssuedand the purchase-order events ofvendor-connectivitycarry none. These pages assume the request holdspoNumber,packageNo,assignmentId,orderIdandtier. - How does the vendor print the label? The Vendor API Label is only
labelRef + trackingNumber + carrier, and no route of this context renders a printable label. - Node types (resolved, G3).
LoadArrivedcarriesnodeType, so a delivery station is told from a sortation centre without anode-topologyevent. - Direct injection (resolved, G3). A
FULFILLMENT_CENTER -> DELIVERY_STATIONlane (theSAME_DAYpath) arrives at a station straight after handover through the transitionHANDED_OVER -> AT_STATION. - What is the expected leg time for
ExceptionOnSilence? This context consumes no departure, lane or wave data, and the tolerance is not set. - What triggers
ReturnToSender,DeclareLostandStartJourney? (resolved, ADR 0002 A4, A8)StartJourneyruns insideIssueLabel.ReturnToSenderis triggered bylast-mile-delivery'sPackageReturnInitiatedon anAT_STATIONjourney.DeclareLostis the silence sweep: anIN_TRANSITjourney whoseNO_SCANexception stayed unanswered for 48 hours. - What does
VoidLabeldo to the journey? (resolved, ADR 0002 A13) It closes aLABELLEDjourney asVOIDEDin the same transaction. A journey pastLABELLEDthat is still open refuses withErrVoidAfterHandover(409void-after-handover); a closed one, for exampleDELIVERED, withErrJourneyClosed(409journey-closed). - How long is the ship-to snapshot kept? (resolved, G40). 30 days after the journey closes (
DELIVERED,RETURNED,LOST, orVOIDEDwhen the label was voided), then the jobPurgeShipTodeletes it (policyShipToRetention).