Skip to main content

Context Map

Following ddd-crew Context Mapping. This is yard-management's slice of the yard context map: every relationship it has, with the upstream (U) and downstream (D) side, the pattern and the channel. Abbreviations: OHS = Open Host Service, PL = Published Language, CF = Conformist, C/S = Customer/Supplier.

Source: internal/domain/trailer/events.go, internal/adapters/outbound/kafka/encoder.go, internal/adapters/inbound/kafka/consumer.go, apis/asyncapi.yaml.

Legend: arrows point from upstream to downstream. Solid = events or commands; dotted = synchronous query. dock-scheduling and inbound-receiving each appear twice because they are on both sides: they feed this context and consume from it. inbound-receiving consumes only VisitCheckedIn; as built it does not consume TrailerDocked. People are rounded boxes.

Omitted: Kafka and Postgres as infrastructure; the analytics-only events (warehouse.yard-management.analytics), which have no named consumer; the fleet's other edges of dock-scheduling (warehouse-planning, process-path-management), which this context has no message with. Retail network: no edge at all. The model's hard_boundary forbids this context from consuming any retailnetwork.* topic or calling a retail-network service; the only channel to the network stays network-fulfillment and the Vendor API.

Relationships​

NeighbourDirectionPatternChannelMessagesWhy this pattern
dock-schedulingUpstreamCustomer/Supplier (this context is the Customer)Kafka warehouse.dock-scheduling.eventsDockAppointmentBooked, DockAppointmentRescheduled, DockAppointmentCancelled, DockAppointmentNoShow, DoorClosureScheduled, DoorClosureLifted, CarrierRegistered, CarrierSuspended, CarrierReinstatedThe model lists this context among the named consumers of the appointment and closure events. They feed AppointmentView and DoorClosureView, which gate check-in (ErrAppointmentRequired), direct a trailer to its door and refuse a closed door. The three carrier events (service ADR 0016) feed the carriers copy that the suspended-carrier rule of the gate reads.
dock-schedulingDownstreamCustomer/Supplier (dock-scheduling is the Customer)Kafka warehouse.yard-management.eventsVisitCheckedIn, VisitRejected, TrailerDocked, TrailerUndockedPhysical facts win (YD-0004): dock-scheduling applies arrival (ArrivalFromGate), the actual door (ActualDoorWins) and door release (CompleteOnDoorRelease) from them. Neither context writes into the other's aggregates.
facility-layoutUpstreamConformistKafka warehouse.facility.eventsLocationSlotRegistered, LocationSlotDecommissioned, ZoneRegisteredA registry for every context; it does not adapt to this one. Roles Yard and Dock, dockFlow, the optional spotKind of a yard spot (ADR 0014; the optional gln is not used) and zoneId to siteCode are taken as given into LocationView.
inbound-receivingUpstreamConformistKafka warehouse.inbound-receiving.eventsASNRegistered, ASNCancelled, ReceiptOpened, ReceiptClosedASNs say what an inbound trailer holds (AsnContentView); receipts at a door close the unload (AutoCompleteUnload, via ReceiptAtDoorView).
inbound-receivingDownstreamNo pattern named (the neighbour's ADR 0021 names none)Kafka warehouse.yard-management.eventsVisitCheckedIninbound-receiving keeps the gate arrival of an appointment (visit_arrivals) for its dock-to-stock measure; its consumer reads no other type of this topic and commits the rest past (visit_arrival_consumer.go in inbound-receiving on origin/develop).
outbound-shippingDownstreamCustomer/Supplier (this page's reading)Kafka warehouse.yard-management.eventsTrailerDocked, DoorWorkCompleted, TrailerDepartedShip-confirm follows the physical departure: a closed load is confirmed shipped when its trailer leaves the site (merged on develop, not deployed; the two door-work and departure events moved to the integration topic for it, service ADR 0010). The optional inbound-receiving consumer of TrailerDocked the model named was not built.
exception-managementDownstreamCustomer/Supplier (this page's reading)Kafka warehouse.yard-management.eventsVisitRejected, SealExceptionRaised, TrailerDwellExceeded, YardCheckClosedThe model lists it as consumer; fleet_changes records a new consumer that opens problem cases (one per yard-check discrepancy).
Gate clerk or kioskUpstream (person / device)UI on this context's RESTREST POST /visits, POST /visit-rejections, POST /visits/{visitId}/check-outsCheckInVisit, RejectAtGate, CheckOutVisitThe gate is operated by a person or issued by an adapter (kiosk, camera, ANPR) around CheckInVisit.
HostlerUpstream (person, floor client)UIREST POST /moves/claims, POST /moves/{moveId}/completionsClaimNextMove, CompleteMoveHostlers pull work; nothing is pushed.
Dock operatorUpstream (person, floor client)UIREST POST /trailers/{trailerId}/door-work-starts, .../door-work-completionsStartDoorWork, CompleteDoorWorkDoor work is recorded by the people doing it.
Yard supervisorUpstream (person, console)UIREST moves, holds, seals, yard policy, yard checksRequestMove, CancelMove, PlaceHold, ReleaseHold, RecordSeal, DeclareYardPolicy, OpenYardCheck, RecordObservation, CloseYardCheckSupervision and exceptions.
Scheduler (cron)Upstream (CronJob)UIREST POST /dwell-sweeps, POST /move-lease-sweepsDwellSweep, ExpireLeaseTime-driven rules; both sweeps are idempotent.
Any contextDownstreamOHSREST GET /visits, /trailers, /moves, /sites/{siteId}/yard-board, /sites/{siteId}/yard-policy, /reports/* (served by yard-reports)ListVisits, GetVisit, ListTrailers, GetTrailer, ListMoves, GetYardBoard, GetYardPolicyRead access for tools and diagnostics; no context depends on it for a decision (decision paths use events).
warehouse-console, warehouse-floor-client, warehouse-ops-agentDownstream clientsOHS (read) and UI (screens)REST and MCP toolsYard Board remote; gate, hostler and dock operator screens (the console and floor-client work is not checked here); the service's own MCP tools: 8 L1 reads and 8 L3 writesfleet_changes first said the ops agent has no write tools; as built the service's MCP server has eight L3 write tools that need a human approval.

Notes on the patterns​

  • A mutual Customer/Supplier pair, not a Shared Kernel. dock-scheduling and this context consume each other's events and share no tables, code or write path. The flows are independent (plan versus physical), and each keeps an event-fed local copy of what it needs.
  • Conformist upstream for registries. facility-layout and inbound-receiving publish one language for all consumers; this context takes it as given.
  • No Anti-Corruption Layer. All neighbours are in the same organization and share the CloudEvents standard; translation is limited to projecting events into local read models. A future transport-visibility context would add one (ACL to an external ETA feed) on the dock-scheduling side, not here.
  • No synchronous call in either direction (sync_calls: []). The site of a door or spot comes from the LocationView join of LocationSlotRegistered.zoneId and ZoneRegistered{zoneId, siteCode}.