Skip to main content

Bounded Context Canvas

As built

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[linehaul-transportation] → inbound, rest, publishes, consumes and sync_calls (empty).

Canvas at a glance​

Two pictures of the sections below: first the collaborators that command, query or feed this context (with its purpose, roles and the decisions it enforces), then the collaborators it notifies. Arrows follow the message type: solid blue commands (cmd), dotted green queries (qry), thick orange events (evt). Box shapes mark the collaborator kind: rounded = people or any client; blue = sibling bounded context; grey = this context's own scheduler; dashed = published with no named consumer (analytics only). Channel names are abbreviated; the tables carry the exact route, topic and CloudEvents type.

Inbound​

Outbound​

Derived from: model.yaml → contexts[linehaul-transportation].inbound, .rest, .publishes, .consumes, .policies[HorizonRoll], .business_decisions, .roles.

Omitted: assumptions, metrics, open questions and the glossary (sections below); the relationship pattern per message (see the tables); full CloudEvents types and routes (see the tables). There are no outbound commands or queries: sync_calls is empty, so this context calls no other context synchronously.

Name​

Linehaul Transportation (linehaul-transportation, code LH, CloudEvents tier logistics).

Purpose​

Run the middle mile. Turn lanes into scheduled departures, including a pickup departure at every vendor node cutoff; keep each departure's remaining capacity; build loads of packages onto departures; report when loads depart and arrive. Promises (delivery-promise) and assignments (order-sourcing) are only as good as these departures, and the last mile (last-mile-delivery) starts when a load arrives.

Strategic Classification​

AxisVerdict
DomainSupporting (see Core Domain Chart).
Business ModelCost reducer (cost-to-serve) and speed enabler.
EvolutionCustom-built.

Domain Roles​

RoleEvidence in the model
Execution (schedules and loads)Generates departures from lane schedules and vendor cutoffs (GenerateDepartures, PickupFromCutoffs, HorizonRoll); runs the load lifecycle (OpenLoad … ReceiveLoad).
Specification (capacity)Publishes each departure's capacity and remaining room (DepartureScheduled, DepartureCapacityChanged); delivery-promise and order-sourcing plan against it.

Inbound Communication​

CollaboratorMessageTypeChannelRelationship
Network-ops plannerDefineLaneScheduleCommandREST POST /lane-schedulesUI
Network-ops plannerRetireLaneScheduleCommandREST POST /lane-schedules/{laneId}/retirements (route in rest; the inbound row does not name this message, see Open Questions)UI
Network-ops plannerCancelDepartureCommandREST POST /departures/{departureId}/cancellationsUI
Sort-centre and station operatorsOpenLoadCommandREST POST /loadsUI
Sort-centre and station operatorsAddPackageCommandREST POST /loads/{loadId}/packagesUI
Sort-centre and station operatorsCloseLoadCommandREST POST /loads/{loadId}/closuresUI
Sort-centre and station operatorsDispatchLoadCommandREST POST /loads/{loadId}/dispatchesUI
Sort-centre and station operatorsReceiveLoadCommandREST POST /loads/{loadId}/receiptsUI
Any contextListDeparturesQueryREST GET /departures?origin=&destination=&from=&to=OHS
Any contextGet one departure (no message name in the model)QueryREST GET /departures/{departureId}OHS
Scheduler (internal)GenerateDeparturesCommandnightly timer (policy HorizonRoll)Internal
node-topologyNodeRegisteredEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeRegisteredConformist
node-topologyNodeOperationalProfileDeclaredEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeOperationalProfileDeclaredConformist
node-topologyNodeActivatedEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeActivatedConformist
node-topologyNodeSuspendedEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeSuspendedConformist
node-topologyNodeRetiredEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeRetiredConformist
node-topologyLaneOpenedEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.lane.LaneOpenedConformist
node-topologyLaneClosedEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.lane.LaneClosedConformist
order-sourcingFulfillmentReleasedToNodeEventKafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentReleasedToNodeCustomer/Supplier
order-sourcingFulfillmentReassignedEventKafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentReassignedCustomer/Supplier
order-sourcingFulfillmentLockedEventKafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentLockedCustomer/Supplier
order-sourcingFulfillmentCancelledEventKafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentCancelledCustomer/Supplier
shipping-and-trackingLabelIssuedEventKafka retailnetwork.shipping-and-tracking.events, com.retailnetwork.logistics.shipping-and-tracking.label.LabelIssuedConformist

Outbound Communication​

CollaboratorMessageTypeChannelRelationship
delivery-promise, order-sourcingDepartureScheduledEventKafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.departure.DepartureScheduledOHS + PL (they are Conformist)
delivery-promise, order-sourcingDepartureCapacityChangedEventKafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.departure.DepartureCapacityChangedOHS + PL (they are Conformist)
delivery-promise, order-sourcingDepartureCancelledEventKafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.departure.DepartureCancelledOHS + PL (they are Conformist)
analytics onlyDepartureDepartedEventKafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.departure.DepartureDepartedPL, no in-org consumer
analytics onlyDepartureArrivedEventKafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.departure.DepartureArrivedPL, no in-org consumer
analytics onlyLoadClosedEventKafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.load.LoadClosedPL, no in-org consumer
shipping-and-trackingLoadDepartedEventKafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.load.LoadDepartedOHS + PL (Conformist)
shipping-and-tracking, last-mile-deliveryLoadArrivedEventKafka retailnetwork.linehaul-transportation.events, com.retailnetwork.logistics.linehaul-transportation.load.LoadArrivedshipping-and-tracking Conformist; last-mile-delivery Customer/Supplier
—(no synchronous calls)—sync_calls: []—

Full message details: Domain Events. Relationship evidence: Context Map.

Ubiquitous Language​

Full glossary: Ubiquitous Language. Top terms: Middle Mile, Departure (kinds PICKUP, LINEHAUL, AIR), Pickup Departure, Capacity (packages, booked), Load, Lane Schedule.

Business Decisions​

  1. One pickup per cutoff per operating day. Every declared cutoff of an ACTIVE vendor fulfillment node gets one PICKUP departure per operating day (policy PickupFromCutoffs; future pickups are cancelled on NodeSuspended or NodeRetired).
  2. booked <= capacity. BookCapacity refuses with ErrDepartureFull.
  3. No booking after cutoffAt (ErrDepartureClosed).
  4. Departures are scheduled only on an OPEN lane (ErrLaneClosed), with cutoffAt <= departsAt < arrivesAt (ErrInvalidDepartureTimes).
  5. A package is on at most one open load (ErrPackageAlreadyLoaded), and a load never carries more packages than its departure's capacity (ErrLoadOverCapacity).
  6. Book on lock. One package is booked on the pickup departure when an assignment locks (FulfillmentLocked; policy BookOnLock). It is not released on FulfillmentCancelled or reassignment: those happen only before the lock and update the expected volume only (ADR 0002 A16); the release branch was removed. A follower's lock of a consolidation merge (consolidatedInto set) books nothing, so one merged package occupies one package of pickup capacity (policy FollowerLockBooksNothing).
  7. Announce cancellations early. A cancelled departure is announced before its cutoff wherever possible, so delivery-promise can revise the promises on it.
  8. Keep a 14-day horizon (policy HorizonRoll).

Assumptions​

  • node-topology publishes every cutoff in NodeOperationalProfileDeclared with the node's time zone and operating hours, and activates a node only after its profile is complete (ErrIncompleteOperationalProfile on its side).
  • A vendor fulfillment node has an OPEN lane to the node its pickups go to; otherwise no pickup can be scheduled (ErrLaneClosed).
  • order-sourcing locks an assignment before the pickup cutoff (its VirtualQueue policy releases at cutoff minus handling time minus the ack budget), so BookOnLock normally lands before cutoffAt.
  • Consumers rebuild their departure views from events only; there is no synchronous call into this context on the promise hot path.

Verification Metrics​

MetricTargetSource
Share of declared cutoffs of ACTIVE vendor FCs with a PICKUP departure for each day of the horizon100%NodeProfileView × departures
Departures with booked > capacity0departures table check
Share of DepartureCancelled whose cancelledAt is before the departure's cutoffAtas high as possible; report weeklyDepartureCancelled vs DepartureScheduled
Lag from NodeOperationalProfileDeclared to the matching DepartureScheduledp95 under one minuteevent timestamps
Days of horizon covered after the nightly roll14departures per lane
BookCapacity refused with ErrDepartureFull or ErrDepartureClosedtrend to 0use-case error counter
AddPackage refused with ErrPackageAlreadyLoadedtrend to 0use-case error counter
Lag from ReceiveLoad to LoadArrived on the topicp95 under 10 soutbox relay

Open Questions​

Each of these is a gap in model.yaml reported to the orchestrator, not patched here.

  • Who triggers CloseDeparture, RecordDeparture and RecordArrival? (resolved, ADR 0002 A21) The load commands: CloseLoad runs CloseDeparture, DispatchLoad runs RecordDeparture and ReceiveLoad runs RecordArrival, each in the load's transaction.
  • How does capacity change? DepartureCapacityChanged carries capacityPackages, but the only commands that touch capacity are BookCapacity and ReleaseCapacity, which change booked.
  • Pickup capacity and destination (resolved, G9). The lane of a PICKUP departure is the node's open ground lane that ranks first by destination type (sort centre first), then lowest nominal transit, then lowest lane id (policy DefaultOutboundLane). Its package capacity is the orders the node can take in the window times this context's own packagesPerOrder setting (policy PickupCapacity). node-topology declares neither.
  • Pickups on activation. PickupFromCutoffs fires on NodeOperationalProfileDeclared, but a profile is declared before the node is ACTIVE; NodeActivated is consumed with no stated reaction.
  • A full pickup at lock time. BookOnLock runs after the vendor has accepted; the model names no follow-up when it hits ErrDepartureFull.
  • Unreachable release. order-sourcing reassigns and cancels only before LOCKED, so the release branch of BookOnLock never finds a booking to release.
  • RetireLaneSchedule and GET /departures/{departureId} have routes but no inbound message row.