Skip to main content

Context map

Following ddd-crew Context Mapping. This is shipping-and-tracking's slice of the domain-wide context map: every relationship this context has, with the upstream (U) and downstream (D) side, the pattern and the channel. Classifications are those of Subdomain classification. The protocols and failure behaviour of each edge are on Integration.

Upstream: what shipping-and-tracking consumes or calls​

Source: internal/adapters/outbound/customerordering/gateway.go, internal/adapters/inbound/kafka/handlers.go.

Downstream: who calls or consumes shipping-and-tracking​

Source: apis/openapi.yaml and the consumer lists in apis/asyncapi.yaml. Legend: arrows point from upstream to downstream; CF = Conformist, C/S = Customer/Supplier, OHS = Open Host Service; path parameters are left out of the diagram. The dotted line without an arrow head is a relationship that is deliberately absent.

Omitted: the callers of POST /journeys/{trackingNumber}/scans and POST /labels/{labelRef}/voids, which neither the code nor the contracts name; Postgres and Kafka as infrastructure. There is no edge to node-topology: this context consumes no node event.

Edges​

NeighbourDirectionPatternChannelMessagesWhy this pattern
vendor-connectivity (Supporting)ST upstream, VC downstreamCustomer/Supplier (VC is the customer)REST POST /labelsIssueLabelvendor-connectivity needs a label inside a vendor request; this context shapes the route for that one caller
vendor-connectivity (Supporting)VC upstream, ST downstreamCustomer/Supplier (ST is the customer)Kafka retailnetwork.vendor-connectivity.eventsVendorShipmentConfirmedThe vendor's shipment statement names tracking numbers this context issued; both sides agree the fields
customer-ordering (Generic)CO upstream, ST downstreamCustomer/Supplier (ST is the customer)REST GET {CUSTOMER_ORDERING_URL}/orders/{orderId}/ship-toGetShipToThe only synchronous call this context makes, once per label, never on the tracking path
customer-ordering (Generic)ST upstream, CO downstreamOpen host service (query) and conformist (events)REST GET /journeys/{trackingNumber}; Kafka retailnetwork.shipping-and-tracking.eventsGetJourney; LabelIssued, LabelVoided, PackageScanned, PackageDelivered, PackageExceptionRaisedThe journey route is open to any reader; customer-ordering takes the events as published
linehaul-transportation (Supporting)LH upstream, ST downstreamConformistKafka retailnetwork.linehaul-transportation.eventsLoadDeparted, LoadArrivedLinehaul publishes load facts for its own purposes; this context adapts one load event into one scan per tracking number
linehaul-transportation (Supporting)ST upstream, LH downstreamConformistKafka retailnetwork.shipping-and-tracking.eventsLabelIssued, LabelVoidedLinehaul counts expected volume from labels as published
last-mile-delivery (Supporting)LM upstream, ST downstreamConformistKafka retailnetwork.last-mile-delivery.eventsPackageOutForDelivery, DeliveryAttempted, PackageReturnInitiatedRoute facts, one tracking number each, taken as published
last-mile-delivery (Supporting)ST upstream, LM downstreamConformistKafka retailnetwork.shipping-and-tracking.eventsLabelIssuedStops are grouped by the opaque stopKey
offer-availability (Supporting)OA upstream, ST downstreamConformistKafka retailnetwork.offer-availability.eventsCatalogItemCreatedItem dimensions and handling flags for the local catalog_dimensions read model
delivery-promise (Core)ST upstream, DP downstreamConformistKafka retailnetwork.shipping-and-tracking.eventsPackageDelivered, PackageExceptionRaised, PackageReturned, PackageLostThe Core context conforms to a Generic one's facts: it needs only the fact and its time
order-sourcing (Core)ST upstream, OS downstreamConformistKafka retailnetwork.shipping-and-tracking.eventsPackageDeliveredCloses the assignment
node-performance (Supporting)ST upstream, NP downstreamConformistKafka retailnetwork.shipping-and-tracking.eventsPackageHandedOverOn-time handover is scored from this context's observed handover, never from the vendor's statement
Shoppers, console, agentsST upstreamOpen host serviceREST GET /journeys/{trackingNumber}, MCP and A2A get_journey, the shipping_mfe remoteGetJourneyAny client may read a journey by tracking number
warehouse-systems fleetnoneSeparate waysnonenoneThe fleet reaches the network only through the Vendor API of vendor-connectivity

The downstream consumer names come from the AsyncAPI descriptions; this repository does not verify that each consumer is deployed.

Notes on the patterns​

  • Customer/Supplier in both directions with vendor-connectivity. For the label this context is the supplier; for the shipment statement it is the customer. The label fields and the trackingNumbers on VendorShipmentConfirmed must agree.
  • Customer of customer-ordering for one query. A 404 is a validation error on the label request, anything else is ship-to-unavailable, and only label issuing degrades.
  • Conformist downstream of the transport contexts. Load and route events carry what linehaul and last-mile need; this context adapts instead of asking for a new shape, and tolerates absent optional fields (departureKind, nodeType).
  • No shared kernel, no shared tables. Ids such as trackingNumber, poNumber, orderId and nodeId are values, not foreign keys, and the contracts are restated here and pinned by tests rather than imported.