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
| Neighbour | Direction | Pattern | Channel | Messages | Why this pattern |
|---|---|---|---|---|---|
dock-scheduling | Upstream | Customer/Supplier (this context is the Customer) | Kafka warehouse.dock-scheduling.events | DockAppointmentBooked, DockAppointmentRescheduled, DockAppointmentCancelled, DockAppointmentNoShow, DoorClosureScheduled, DoorClosureLifted, CarrierRegistered, CarrierSuspended, CarrierReinstated | The 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-scheduling | Downstream | Customer/Supplier (dock-scheduling is the Customer) | Kafka warehouse.yard-management.events | VisitCheckedIn, VisitRejected, TrailerDocked, TrailerUndocked | Physical 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-layout | Upstream | Conformist | Kafka warehouse.facility.events | LocationSlotRegistered, LocationSlotDecommissioned, ZoneRegistered | A 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-receiving | Upstream | Conformist | Kafka warehouse.inbound-receiving.events | ASNRegistered, ASNCancelled, ReceiptOpened, ReceiptClosed | ASNs say what an inbound trailer holds (AsnContentView); receipts at a door close the unload (AutoCompleteUnload, via ReceiptAtDoorView). |
inbound-receiving | Downstream | No pattern named (the neighbour's ADR 0021 names none) | Kafka warehouse.yard-management.events | VisitCheckedIn | inbound-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-shipping | Downstream | Customer/Supplier (this page's reading) | Kafka warehouse.yard-management.events | TrailerDocked, DoorWorkCompleted, TrailerDeparted | Ship-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-management | Downstream | Customer/Supplier (this page's reading) | Kafka warehouse.yard-management.events | VisitRejected, SealExceptionRaised, TrailerDwellExceeded, YardCheckClosed | The model lists it as consumer; fleet_changes records a new consumer that opens problem cases (one per yard-check discrepancy). |
| Gate clerk or kiosk | Upstream (person / device) | UI on this context's REST | REST POST /visits, POST /visit-rejections, POST /visits/{visitId}/check-outs | CheckInVisit, RejectAtGate, CheckOutVisit | The gate is operated by a person or issued by an adapter (kiosk, camera, ANPR) around CheckInVisit. |
| Hostler | Upstream (person, floor client) | UI | REST POST /moves/claims, POST /moves/{moveId}/completions | ClaimNextMove, CompleteMove | Hostlers pull work; nothing is pushed. |
| Dock operator | Upstream (person, floor client) | UI | REST POST /trailers/{trailerId}/door-work-starts, .../door-work-completions | StartDoorWork, CompleteDoorWork | Door work is recorded by the people doing it. |
| Yard supervisor | Upstream (person, console) | UI | REST moves, holds, seals, yard policy, yard checks | RequestMove, CancelMove, PlaceHold, ReleaseHold, RecordSeal, DeclareYardPolicy, OpenYardCheck, RecordObservation, CloseYardCheck | Supervision and exceptions. |
| Scheduler (cron) | Upstream (CronJob) | UI | REST POST /dwell-sweeps, POST /move-lease-sweeps | DwellSweep, ExpireLease | Time-driven rules; both sweeps are idempotent. |
| Any context | Downstream | OHS | REST GET /visits, /trailers, /moves, /sites/{siteId}/yard-board, /sites/{siteId}/yard-policy, /reports/* (served by yard-reports) | ListVisits, GetVisit, ListTrailers, GetTrailer, ListMoves, GetYardBoard, GetYardPolicy | Read access for tools and diagnostics; no context depends on it for a decision (decision paths use events). |
warehouse-console, warehouse-floor-client, warehouse-ops-agent | Downstream clients | OHS (read) and UI (screens) | REST and MCP tools | Yard 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 writes | fleet_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-schedulingand 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-layoutandinbound-receivingpublish 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-visibilitycontext would add one (ACL to an external ETA feed) on thedock-schedulingside, not here. - No synchronous call in either direction (
sync_calls: []). The site of a door or spot comes from theLocationViewjoin ofLocationSlotRegistered.zoneIdandZoneRegistered{zoneId, siteCode}.