Skip to main content

Bounded context canvas

Following the ddd-crew Bounded Context Canvas (v5), filled from the code and ADRs on this branch.

1. Name​

Linehaul Transportation (linehaul-transportation), retail network, tier logistics.

2. Purpose​

Turn the static lanes of the network into concrete, capacity-bounded trips: schedule departures (including a pickup departure at every cutoff of an active vendor node), keep each departure's booked and remaining packages honest, build loads of packages onto departures, and report when loads depart and arrive. Other contexts promise and source against these trips.

3. Strategic classification​

AxisValue
DomainSupporting subdomain (Transportation, middle mile); see Subdomain classification
Business modelCost reducer and speed enabler
EvolutionCustom-built

4. Domain roles​

Execution context: it schedules, books and loads. It also keeps local copies of node, lane and assignment facts (read models) and publishes its own facts.

5. Inbound communication​

MessageFromTypeCollaborator relationship
NodeRegistered, NodeOperationalProfileDeclared, NodeActivated, NodeSuspended, NodeRetirednode-topologyEvent (Kafka)Conformist
LaneOpened, LaneClosednode-topologyEvent (Kafka)Conformist
FulfillmentReleasedToNode, FulfillmentReassigned, FulfillmentLocked, FulfillmentCancelledorder-sourcingEvent (Kafka)Customer/Supplier
LabelIssued, LabelVoidedshipping-and-trackingEvent (Kafka)Conformist
DefineLaneSchedule, RetireLaneSchedule, CancelDeparture, ChangeDepartureCapacitynetwork-ops plannerCommand (REST)Open Host Service
OpenLoad, AddPackage, CloseLoad, DispatchLoad, ReceiveLoadsort-centre and station operatorsCommand (REST)Open Host Service
ListDepartures, GetDepartureany context, console, AI and peer agentsQuery (REST, MCP, A2A)Open Host Service
Timerthe process itselfGenerateDepartures every GENERATE_INTERVALinternal

6. Outbound communication​

MessageToType
DepartureScheduled, DepartureCapacityChanged, DepartureCancelled, BookingMoved, BookingFailed, LoadDeparted, LoadArrivedretailnetwork.linehaul-transportation.eventsEvent (Kafka)
DepartureDeparted, DepartureArrived, LoadClosedretailnetwork.linehaul-transportation.analyticsEvent (Kafka, analytics only)
Dead letters<consumed topic>.dlqKafka
TelemetryOTel CollectorOTLP/gRPC

7. Ubiquitous language​

Ubiquitous language: departure, pickup departure, load, lane schedule, horizon, booking, expected volume.

8. Business decisions​

  1. Every declared cutoff of an ACTIVE vendor fulfillment node gets one pickup departure per operating day.
  2. A departure's booked packages never exceed its capacity.
  3. A package is on at most one OPEN or CLOSED load; a departure has at most one load.
  4. Booking is accepted only on a SCHEDULED departure up to its cutoff.
  5. A locked assignment books one package on its pickup departure; if that fails it moves to the next pickup from the same origin, or fails with a reason.
  6. A cancelled departure rebooks the assignments booked on it in the same transaction.
  7. The node of an assignment never changes after lock; the context only updates its view on reassignment or cancellation (before lock).
  8. Events are published through a transactional outbox, at least once, with a stable id.

It does not decide which node or path fulfils a shipment group, what date the customer is told, or which delivery wave a package joins.

9. Assumptions​

ADR 0002 records the assumptions (A1 to A30) the model left open, for example A9 (PACKAGES_PER_ORDER), A14 (rebooking) and A15 (cancel).

10. Verification metrics​

linehaul.loads.dispatched by outcome; HTTP request duration; the outbox tail (outbox_events with published_at IS NULL); the horizon roll log line with scheduled and failed. See Observability.

11. Open questions​

  • Outbox backlog, consumer lag and dead letters are not metered or alerted.
  • BookingFailed is received by order-sourcing, which changes no state, and by delivery-promise, which flags the assignment's promise AT_RISK; the assignment stays FAILED here and any further follow-up for a failed booking is outside this context.
  • Route optimisation, carrier procurement and freight cost are not modelled.