Skip to main content

Bounded Context Canvas

Following the ddd-crew Bounded Context Canvas v5. Every message row comes from contexts[dock-scheduling] → 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​

Source: internal/adapters/inbound/kafka/*_consumer.go, internal/adapters/outbound/kafka/encoder.go, internal/adapters/inbound/http/server.go, apis/openapi.yaml, apis/asyncapi.yaml.

Outbound​

Source: internal/adapters/inbound/kafka/yard_consumer.go, internal/adapters/inbound/kafka/facility_consumer.go, internal/adapters/inbound/kafka/asn_consumer.go, internal/adapters/inbound/kafka/cutoff_consumer.go, internal/adapters/outbound/kafka/encoder.go, apis/asyncapi.yaml.

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​

Dock Scheduling (dock-scheduling, code DS, CloudEvents subdomain wms).

Purpose​

Own the door calendar of every site: every booked time window on every dock door, inbound and outbound, from booking through arrival to door release, the no-double-booking rule, door opening hours and closures, ETA-driven risk and no-shows. It owns the future of a door; yard-management owns the present of the yard. Each keeps an event-fed local copy of what it needs from the other, and neither records the other's facts.

Strategic Classification​

AxisVerdict
DomainSupporting (see Core Domain Chart).
Business ModelCost reducer (carrier wait, detention, idle dock labour) and revenue protector (on-time inbound).
EvolutionProduct.

Domain Roles​

RoleEvidence in the design model
Specification (door calendar)DockCalendar holds operating hours, closures and settings; every booking is checked against it; GetDockCalendar and GetDoorAvailability publish it.
Gateway for carriers (Open Host Service)The carrier scheduler books, reschedules, cancels and reports ETAs over REST (relationship: OHS); any context queries over REST (OHS).
Analysis (adherence)Read model AdherenceReport: on-time, early, late and no-show share per site and carrier, built from the analytics topic; route GET /reports/schedule-adherence.

Inbound Communication​

The Kafka types are read from each producer's AsyncAPI and the service dispatches on the full type string (process-path-management is in the wes tier: com.warehouse.wes.process-path-management.cptschedule.CPTScheduleChanged).

CollaboratorMessageTypeChannelRelationship
Carrier scheduler (carrier portal)BookAppointmentCommandREST POST /appointmentsOHS
Carrier scheduler (carrier portal)RescheduleAppointmentCommandREST POST /appointments/{appointmentId}/reschedulesOHS
Carrier scheduler (carrier portal)CancelAppointmentCommandREST POST /appointments/{appointmentId}/cancellationsOHS
Carrier scheduler (carrier portal)ReportEtaCommandREST POST /appointments/{appointmentId}/eta-reportsOHS
Dock plannerRescheduleAppointmentCommandREST POST /appointments/{appointmentId}/reschedulesUI
Dock plannerCancelAppointmentCommandREST POST /appointments/{appointmentId}/cancellationsUI
Dock plannerDeclareOperatingHoursCommandREST PUT /sites/{siteId}/dock-calendar/operating-hoursUI
Dock plannerDeclareCalendarSettingsCommandREST PUT /sites/{siteId}/dock-calendar/settingsUI
Dock plannerScheduleDoorClosureCommandREST POST /sites/{siteId}/dock-calendar/closuresUI
Dock plannerLiftDoorClosureCommandREST POST /sites/{siteId}/dock-calendar/closures/{closureId}/liftsUI
Any contextListAppointmentsQueryREST GET /appointmentsOHS
Any contextGetAppointmentQueryREST GET /appointments/{appointmentId}OHS
Any contextGetDoorAvailabilityQueryREST GET /doors/{doorCode}/availabilityOHS
Any contextGetDockCalendarQueryREST GET /sites/{siteId}/dock-calendarOHS
Scheduler (cron)MarkNoShowCommandREST POST /no-show-sweepsUI
yard-managementVisitCheckedInEventKafka warehouse.yard-management.events, com.warehouse.wms.yard-management.yardvisit.VisitCheckedInCustomer/Supplier
yard-managementVisitRejectedEventKafka warehouse.yard-management.events, com.warehouse.wms.yard-management.yardvisit.VisitRejectedCustomer/Supplier
yard-managementTrailerDockedEventKafka warehouse.yard-management.events, com.warehouse.wms.yard-management.trailer.TrailerDockedCustomer/Supplier
yard-managementTrailerUndockedEventKafka warehouse.yard-management.events, com.warehouse.wms.yard-management.trailer.TrailerUndockedCustomer/Supplier
facility-layoutLocationSlotRegisteredEventKafka warehouse.facility.eventsConformist
facility-layoutLocationSlotDecommissionedEventKafka warehouse.facility.eventsConformist
facility-layoutZoneRegisteredEventKafka warehouse.facility.eventsConformist
inbound-receivingASNRegisteredEventKafka warehouse.inbound-receiving.eventsConformist
inbound-receivingASNCancelledEventKafka warehouse.inbound-receiving.eventsConformist
process-path-managementCPTScheduleChangedEventKafka warehouse.process-path-management.eventsConformist

Reports: GET /reports/schedule-adherence and GET /reports/freshness are served by the separate reports binary from apis/openapi-reports.yaml (read-only, on the analytics database) and have an inbound row of their own (dock planner, query).

Outbound Communication​

Topics are warehouse.dock-scheduling.events for integration events (each also goes, as a twin, to the analytics topic) and warehouse.dock-scheduling.analytics for the events the model marks analytics only. The relationship column is the design model's for yard-management and this page's reading for the others.

CollaboratorMessageTypeChannelRelationship
yard-management, warehouse-planning, inbound-receiving, outbound-shippingDockAppointmentBookedEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentBookedyard-management: Customer/Supplier; the others: OHS + PL (reading)
yard-management, warehouse-planning, inbound-receivingDockAppointmentRescheduledEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentRescheduledsame
yard-management, warehouse-planning, inbound-receivingDockAppointmentCancelledEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentCancelledsame
yard-management, warehouse-planning, exception-managementDockAppointmentNoShowEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentNoShowsame
inbound-receivingDockAppointmentDoorReassignedEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentDoorReassignedOHS + PL (reading); integration since 2026-11-09 (service ADR 0010)
yard-managementDoorClosureScheduledEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.dockcalendar.DoorClosureScheduledCustomer/Supplier
yard-managementDoorClosureLiftedEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.dockcalendar.DoorClosureLiftedCustomer/Supplier
yard-managementCarrierRegisteredEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.carrier.CarrierRegisteredCustomer/Supplier
yard-managementCarrierSuspendedEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.carrier.CarrierSuspendedCustomer/Supplier
yard-managementCarrierReinstatedEventKafka warehouse.dock-scheduling.events, com.warehouse.wms.dock-scheduling.carrier.CarrierReinstatedCustomer/Supplier
analytics onlyDockAppointmentCheckedInEventKafka warehouse.dock-scheduling.analytics, com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentCheckedInPL, no in-org consumer
analytics onlyDockAppointmentCompletedEventKafka warehouse.dock-scheduling.analytics, com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentCompletedPL, no in-org consumer
analytics onlyDockAppointmentAtRiskEventKafka warehouse.dock-scheduling.analytics, com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentAtRiskPL, no in-org consumer
analytics onlyDoorOperatingHoursDeclaredEventKafka warehouse.dock-scheduling.analytics, com.warehouse.wms.dock-scheduling.dockcalendar.DoorOperatingHoursDeclaredPL, no in-org consumer
none(no synchronous calls)n/async_calls: []n/a

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

Ubiquitous Language​

Full glossary: Ubiquitous Language. Top terms: Dock Appointment, Door Window, Door Calendar, Closure, Arrival Status, No-Show.

Business Decisions​

  1. One owner of door time. Inbound and outbound appointments share one calendar per door; a door whose dockFlow is Both takes either direction.
  2. No overlap. No two active (BOOKED or CHECKED_IN) appointments overlap on the same door; windows are half-open (ErrDoorDoubleBooked, enforced by domain service DoorSchedule.CheckNoOverlap under a per-door advisory lock).
  3. Direction fits the door. ErrDoorFlowMismatch.
  4. Inside hours, outside closures. ErrDoorUnavailable.
  5. Physical facts are applied, never recorded. Arrival and door release come from yard-management events.
  6. No-show. A BOOKED appointment with no arrival by window_end plus the site's no-show grace becomes NO_SHOW.
  7. Late ETA is advisory. DockAppointmentAtRisk; nothing reschedules automatically.

Assumptions​

Each is an assumption of the design model or of this page's reading; the service's ADR 0002 and ADR 0003 state the ones it relies on.

  • facility-layout publishes every dock slot with its dockFlow and its zoneId, and every zone with its siteCode; a door reaches its site only through that join, never by parsing a location code (conventions.site_key).
  • inbound-receiving publishes ASNRegistered before an appointment names that ASN; otherwise a booking is refused with ErrUnknownAsn.
  • process-path-management publishes CPTScheduleChanged for a site before an outbound appointment names one of its cpt_id values.
  • Yard events can arrive in any order across partitions (they are keyed by visit or trailer, not by appointment); OutOfOrderYardFacts is the rule that absorbs it.
  • Consumers rebuild their views from events only; no sibling is called synchronously.
  • The retail network is out of reach: no retailnetwork.* topic is consumed.

Verification Metrics​

Targets are this page's proposal; neither the design model nor the service sets any. The service exports the counters named below (for example dock_scheduling_ignored_facts_total and dock_scheduling_implicit_arrivals_total).

MetricTarget (proposed)Source
Active appointments that overlap on one door and are not flagged DOOR_REASSIGNED_OVERLAP0dock_appointments table, ActualDoorWins is the only allowed overlap
Share of appointments by ArrivalStatus (EARLY, ON_TIME, LATE) and by NO_SHOW, per site and carrierreport weeklyAdherenceReport
BOOKED appointments past window_end plus no-show grace0 after each sweepdock_appointments table
DockAppointmentAtRisk per ETA report, by causereport weeklyanalytics topic
Yard facts ignored and counted (unknown, terminal, CANCELLED, NO_SHOW)trend to 0use-case counter (policies ArrivalFromGate, OutOfOrderYardFacts)
Bookings refused, by Err... (ErrDoorDoubleBooked, ErrDoorUnavailable, ErrUnknownAsn)report weeklyuse-case error counter
Appointments completed with an implicit arrival (BOOKED to COMPLETED)trend to 0dock_appointments table
Lag from a yard-management event to the matching dock-scheduling eventset before buildevent timestamps

Closed questions​

The gaps this page used to list (DS-G01 to DS-G22) were decided before the build and are folded into the service; the decision per gap is in the Model Gap Register. In short: the arrival tolerance travels on Booked and Rescheduled (DS-G01); VisitRejected cancels with TURNED_AWAY (DS-G02); one appointment covers one trailer (DS-G03); PickupFromCutoffs is phase 2 and only the schedule is stored (DS-G04, DS-G05); a reschedule may change the door (DS-G06); the calendar is created lazily and open 24x7 until hours are declared (DS-G07); the legacy import (removed in ADR 0011) enforced nothing (DS-G08); the planner may cancel and reschedule (DS-G10); the aggregate exposes atRisk (DS-G11); a decommissioned door blocks new bookings only and new hours that strand an appointment are refused (DS-G12, DS-G13); door codes are globally unique (DS-G15); NO_SHOW is terminal, a late carrier books anew (DS-G16); 409 for conflicts and 422 for value rules (DS-G17).