Skip to main content

Context map

Following ddd-crew Context Mapping. This is order-sourcing's slice of the retail-network context map (in the aggregator, network context map): every relationship this context has, with the upstream (U) and downstream (D) side, the pattern and the channel. Four neighbours appear on both sides: this context consumes from them and they consume from it. The pattern of each direction is the one the downstream side declares. The status of every edge in code is on Integration.

Upstream of order-sourcing​

Source: internal/adapters/inbound/kafka/handlers.go (Handlers.Topics: nine topics, nine consumer groups). Classification labels come from the aggregator's network table, see Subdomain classification.

Downstream of order-sourcing​

Source: internal/domain/assignment/events.go and internal/adapters/outbound/kafka/encoder.go (what is published), the six downstream handler files listed on Integration (who reads it), internal/adapters/inbound/http, mcp, a2a (the planner surface). The vendor-connectivity to network-fulfillment edge is drawn only to show where the fleet sits; it is not this context's relationship.

Legend: solid arrows point from upstream to downstream; the dotted line without an arrow head is a deliberately absent relationship. C/S Customer/Supplier, CF Conformist, OHS Open Host Service, PL Published Language.

Omitted: analytics-only events (FulfillmentQueued, FulfillmentSourcingDecided, FulfillmentDelivered, AssignmentsConsolidated, AssignmentsDeconsolidated, SourcingPolicyPublished; no domain consumer known), FulfillmentConstraintRevised (no consumer found), Postgres and Kafka as infrastructure, and the future contexts (customer-returns, customer-notification, payments-and-invoicing), which have no edge here.

Relationships​

NeighbourDirectionPatternChannelMessagesWhy this pattern
customer-ordering (Generic)U to OSCustomer/SupplierKafka retailnetwork.customer-ordering.eventsCustomerOrderPlaced, CustomerOrderCancelledSourcing needs every group with its promise constraint (groupNo, promiseId, tier, witnessNodeId, deliverByLatest, lines); the event shape is negotiated for this consumer.
customer-ordering (Generic)OS to UConformist (customer-ordering conforms)Kafka retailnetwork.order-sourcing.eventsFulfillmentLocked, FulfillmentShipped, FulfillmentUnsourceable, FulfillmentCancelled, FulfillmentCancelRefusedIt reflects sourcing facts into its status and tracking view and takes them as published.
delivery-promise (Core)U to OSCustomer/SupplierKafka retailnetwork.delivery-promise.eventsPromiseRevised, PromiseBookExhaustedThe re-promise answers FulfillmentUnsourceable; book exhaustion feeds the 500 point book-pressure term.
delivery-promise (Core)OS to UCustomer/SupplierKafka retailnetwork.order-sourcing.eventsFulfillmentUnsourceable, FulfillmentLocked, FulfillmentShippedThe two Core contexts form a loop: unsourceable, re-promise, re-queue (ADR 0001).
seller-inbound (Supporting)OS to Unot declaredKafka retailnetwork.order-sourcing.eventsFulfillmentReleasedToNode, FulfillmentCancelledRead as demand by seller-inbound; its own context map does not list this edge, so no pattern is stated here.
customer-payments (Generic)OS to UConformistKafka retailnetwork.order-sourcing.eventsFulfillmentShipped, FulfillmentCancelled, FulfillmentUnsourceableThe pattern is the one customer-payments declares on its side; it applies each as a fact on the payment authorization.
vendor-connectivity (Supporting)OS to UCustomer/SupplierKafka retailnetwork.order-sourcing.eventsFulfillmentReleasedToNode, FulfillmentCancelled, FulfillmentReleaseWithdrawnIt turns a release into a purchase order (idempotent on assignmentId + releaseNo) and cancels it on FulfillmentCancelled or when a merged release is withdrawn.
vendor-connectivity (Supporting)U to OSCustomer/SupplierKafka retailnetwork.vendor-connectivity.eventsPurchaseOrderAccepted, PurchaseOrderRejected, PurchaseOrderExpired, VendorShipmentConfirmedThe outcomes carry assignmentId and releaseNo for this consumer; acceptance is the path lock.
linehaul-transportation (Supporting)U to OSConformistKafka retailnetwork.linehaul-transportation.eventsDepartureScheduled, DepartureCapacityChanged, DepartureCancelled, BookingMoved, BookingFailedDepartures are linehaul's published facts; they feed the departures read model.
linehaul-transportation (Supporting)OS to UCustomer/SupplierKafka retailnetwork.order-sourcing.eventsFulfillmentReleasedToNode, FulfillmentReassigned, FulfillmentLocked, FulfillmentCancelledLinehaul expects volume and books the pickup on lock.
shipping-and-tracking (Generic)U to OSConformistKafka retailnetwork.shipping-and-tracking.eventsPackageDeliveredA tracking fact, taken as published; drives MarkDelivered.
node-topology (Supporting)U to OSConformistKafka retailnetwork.node-topology.eventsNode*, Lane*, ServiceAreaAssigned, RegionDefined (10 types)Master data of the network's shape.
offer-availability (Supporting)U to OSConformistKafka retailnetwork.offer-availability.eventsListing* (4 types), CatalogItemDiscontinuedWhich node can ship which item and the listingId a release must carry.
last-mile-delivery (Supporting)U to OSConformistKafka retailnetwork.last-mile-delivery.eventsDeliveryWaveScheduled, DeliveryWaveCapacityChanged, DeliveryWaveCancelled, WaveCostDeclaredWave capacity for the last leg of a candidate.
node-performance (Supporting)U to OSConformistKafka retailnetwork.node-performance.eventsNodeScorecardUpdatedMeasured performance feeds the scorecard penalty.
Network-ops planner, console, agentsOS to plannerOpen Host (UI)REST /assignments; MCP /mcp; A2A /a2alist, get, re-optimise (REST only)An operator and agent surface; no auth.
network-fulfillment (warehouse-systems fleet)noneSeparate WaysnonenoneThe hard boundary: no retail-network context calls a fleet service or reads a fleet topic. The fleet reaches this context's decisions only as purchase orders it polls from vendor-connectivity's Vendor API.

Notes on the patterns​

  • Customer/Supplier both ways with delivery-promise. Not a Shared Kernel: no model element is shared. The promise constraint crosses as fields inside CustomerOrderPlaced, and the loop closes with FulfillmentUnsourceable and PromiseRevised.
  • Conformist to the logistics and partner master data. Topology, availability, departures, waves and scorecards are consumed as published into local read models; their owners do not adapt to this context.
  • No synchronous dependency. Every decision is made from local, event-fed read models, so a neighbour outage delays freshness, never a release.
  • No Anti-Corruption Layer is needed. Every neighbour speaks the same network language; the ACL toward the fleet lives in the fleet, behind vendor-connectivity.