Skip to main content

Domain Events

Built, released at v0.1.3, applied to k3s (reduced footprint); MCP and A2A built, not deployed

Built on develop (merged 2026-11-08) in IQVO/dock-scheduling, released at v0.1.3 (first release v0.1.0 on 2026-11-09; applied to the k3s cluster on 2026-11-10 at v0.1.2 in a reduced footprint, and the image pinned to the v0.1.3 commit a1a029c in warehouse-infra since 2026-11-16, checked 2026-12-02): dock-scheduling runs its API only (it relays inline); yard-management runs its API and relay. The MCP server (18 tools on develop 096db0a, 14 in v0.1.3) is registered in warehouse-infra but switched off until the cluster has room; the A2A agent (two skills) is built on develop (2026-12-02), not released and not deployed (the chart carries it off by default and warehouse-infra has no a2a block); the analytics projectors, report services and sweeps are registered but switched off, so the KPI reports of yard-management ADR 0011 are released, not yet served. The page still derives from yard/model/model.yaml; where the as-built service differs, the model and this page say so (see the as-built notes).

Every event this context publishes and consumes, from contexts[dock-scheduling].publishes and .consumes. The envelope follows conventions.cloudevents in the model.

Envelope​

AttributeValue
specversion1.0 (structured JSON mode)
ida UUID minted once, when the event is written to the outbox; a redelivery carries the same id
source/warehouse/dock-scheduling
typecom.warehouse.wms.dock-scheduling.<entity>.<EventName>, entity dockappointment or dockcalendar
subjectthe aggregate root id: appointmentId for dockappointment events, siteId for dockcalendar events
timethe instant the fact happened, UTC
datacontenttypeapplication/json
dataschemaurn:warehouse:dock-scheduling:events:<EventName>:v1 on the integration topic, urn:warehouse:dock-scheduling:analytics:<EventName>:v1 on its analytics twin
Kafka topicwarehouse.dock-scheduling.events for integration events, warehouse.dock-scheduling.analytics for events marked analytics only
Kafka keythe same id as subject, so one appointment's (or one site calendar's) events stay in order on one partition
Payload casesnake_case
versionin data of every event except DockAppointmentAtRisk: the aggregate version (starts at 1, plus 1 per accepted change); a reader applies only a version greater than the stored one

Every event leaves through the transactional outbox, in the same transaction as the aggregate change: one outbox row, up to two Kafka messages. Events the model marks analytics only go only to warehouse.dock-scheduling.analytics; integration events go to warehouse.dock-scheduling.events and, as a twin with the same id, type, key and data, to warehouse.dock-scheduling.analytics (conventions.analytics_rule; the service's ADR 0004 and, for DockAppointmentDoorReassigned, ADR 0010). As built the AsyncAPI is version 2.6.0 with one channel per topic: seven integration types on the events channel, all eleven on the analytics channel.

Published​

Appointment events (key appointmentId)​

EventFull typeStreamdata fieldsProducing commandConsumers
DockAppointmentBookedcom.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentBookedintegration + analytics twinappointment_id, site_id, direction, door_code, carrier, carrier_scac, window_start, window_end, asn_numbers, cpt_id, shipment_refs, expected_seal_number, arrival_tolerance_minutes, provenance, versionBookAppointmentyard-management, warehouse-planning, inbound-receiving, outbound-shipping
DockAppointmentRescheduledcom.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentRescheduledintegration + analytics twinappointment_id, site_id, door_code, previous_door_code, window_start, window_end, previous_window_start, previous_window_end, arrival_tolerance_minutes, versionRescheduleAppointment (window and/or door; carries previous_door_code)yard-management, warehouse-planning, inbound-receiving
DockAppointmentCancelledcom.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentCancelledintegration + analytics twinappointment_id, site_id, door_code, reason, versionCancelAppointment (carrier or planner request; policies CancelOnVisitRejected with TURNED_AWAY and CancelWhenAllAsnsCancelled with ASN_CANCELLED)yard-management, warehouse-planning, inbound-receiving
DockAppointmentNoShowcom.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentNoShowintegration + analytics twinappointment_id, site_id, door_code, direction, carrier_scac, window_end, versionMarkNoShow (policy NoShowSweep)yard-management, warehouse-planning, exception-management
DockAppointmentDoorReassignedcom.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentDoorReassignedintegration + analytics twinappointment_id, site_id, from_door_code, to_door_code, versionReassignDoor (policy ActualDoorWins)inbound-receiving
DockAppointmentCheckedIncom.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentCheckedInanalytics onlyappointment_id, site_id, door_code, checked_in_at, arrival_status, visit_id, versionRecordArrival (policy ArrivalFromGate)analytics only
DockAppointmentCompletedcom.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentCompletedanalytics onlyappointment_id, site_id, door_code, completed_at, versionRecordDoorRelease (policy CompleteOnDoorRelease)analytics only
DockAppointmentAtRiskcom.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentAtRiskanalytics onlyappointment_id, site_id, door_code, eta_at, window_start, window_end, causeReportEta (policy EtaRisk), ReassignDoor (policy ActualDoorWins)analytics only

Calendar events (key siteId)​

EventFull typeStreamdata fieldsProducing commandConsumers
DoorClosureScheduledcom.warehouse.wms.dock-scheduling.dockcalendar.DoorClosureScheduledintegration + analytics twinsite_id, closure_id, door_code, from, to, reason, versionScheduleDoorClosureyard-management
DoorClosureLiftedcom.warehouse.wms.dock-scheduling.dockcalendar.DoorClosureLiftedintegration + analytics twinsite_id, closure_id, door_code, versionLiftDoorClosureyard-management
DoorOperatingHoursDeclaredcom.warehouse.wms.dock-scheduling.dockcalendar.DoorOperatingHoursDeclaredanalytics onlysite_id, door_code, operating_hours, versionDeclareOperatingHoursanalytics only

Stream: integration + analytics twin is warehouse.dock-scheduling.events plus the same message on warehouse.dock-scheduling.analytics; analytics only is the analytics topic alone.

Enumerations used in the payloads: direction is INBOUND or OUTBOUND; arrival_status is EARLY, ON_TIME or LATE; reason of DockAppointmentCancelled is a CancellationReason (CARRIER_REQUEST, SITE_REQUEST, ASN_CANCELLED, TURNED_AWAY); cause of DockAppointmentAtRisk is an AtRiskCause (LATE_ETA, DOOR_REASSIGNED_OVERLAP).

"Analytics only" means no other context reads the event; the service's projector folds it into the adherence report. No context may depend on those events for a decision without a model change. DockAppointmentDoorReassigned stopped being analytics only on 2026-11-09 (service ADR 0010): inbound-receiving keeps its copy of the appointment's door from it. Commands that raise no event: ReportEta (unless the ETA is late), DeclareCalendarSettings. DockAppointmentAtRisk carries no version; the REST appointment exposes atRisk and atRiskCause instead.

Example: a no-show​

DockAppointmentNoShow is one of the events with three consumers. Ids and times are illustrative; the data fields are exactly those in the model and the AsyncAPI.

{
"specversion": "1.0",
"id": "6f1d2c4e-8a1b-4e8f-9b4a-2d5c7e9f1a30",
"source": "/warehouse/dock-scheduling",
"type": "com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentNoShow",
"subject": "appt-0001",
"time": "2026-11-06T14:40:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:dock-scheduling:events:DockAppointmentNoShow:v1",
"data": {
"appointment_id": "appt-0001",
"site_id": "SITE-A",
"door_code": "D07",
"direction": "INBOUND",
"carrier_scac": "ABCD",
"window_end": "2026-11-06T14:00:00Z",
"version": 2
}
}

Consumed​

Every consumer is idempotent on the CloudEvents id (a row in processed_events written in the same transaction as the effect) and dispatches on the full type string, never on a suffix (conventions.integration_rules). A fact that is valid but changes nothing (an unknown or terminal appointment, a site mismatch, an unknown door) is counted in dock_scheduling_ignored_facts_total and committed; a payload that can never be applied is dead-lettered to <topic>.dlq. The four consumers and their environment variables are in the service's ADR 0009. The full types: yard-management events are com.warehouse.wms.yard-management.<entity>.<EventName> (entity yardvisit or trailer), process-path-management is in the wes tier (com.warehouse.wes.process-path-management.cptschedule.CPTScheduleChanged), the others are read from each producer's AsyncAPI.

ProducerEvent and topicdata fields the model relies onWhat this context does with itIdempotency beyond the inbox (as built)
yard-managementVisitCheckedIn, warehouse.yard-management.eventsappointment_id, visit_id, arrived_atPolicy ArrivalFromGate: when it names an appointment_id, RecordArrival with arrival_status from the window and the arrival toleranceAn appointment already CHECKED_IN is left unchanged; unknown and terminal ones are ignored and counted; a blank appointment_id (walk-in, drop) applies nothing
yard-managementVisitRejected, warehouse.yard-management.eventsappointment_idPolicy CancelOnVisitRejected: a BOOKED appointment is cancelled with reason TURNED_AWAYAny other state, an unknown id or a site mismatch is ignored and counted
yard-managementTrailerDocked, warehouse.yard-management.eventsdoor_code, appointment_idPolicy ActualDoorWins: if the door differs from the booked door, ReassignDoor (the physical fact wins, the overlap refusal is skipped) and DockAppointmentDoorReassigned; later appointments now overlapping get DockAppointmentAtRiskSame door: no change
yard-managementTrailerUndocked, warehouse.yard-management.eventsdoor_code, appointment_idPolicy CompleteOnDoorRelease: when it names an appointment_id, RecordDoorRelease; OutOfOrderYardFacts covers a BOOKED appointment (implicit arrival)A COMPLETED appointment is not completed twice
facility-layoutLocationSlotRegistered, warehouse.facility.eventslocationCode, zoneId, role, dockFlowUpserts a Dock slot into DoorView (doors); a door whose zone has not arrived is held pending and cannot be bookedUpsert on the door code
facility-layoutLocationSlotDecommissioned, warehouse.facility.eventslocationCodeDeletes the door from DoorView: new bookings fail with ErrUnknownDoor, existing appointments are left untouched (D-7)Delete is naturally repeatable
facility-layoutZoneRegistered, warehouse.facility.eventszoneId, siteCodeMaps zoneId to siteCode, which gives every door its site_id (zones)Upsert on zoneId
inbound-receivingASNRegistered, warehouse.inbound-receiving.eventsasn_number, expected_arrival, linesInserts the ASN into AsnView (asns)Upsert on asn_number; a cancelled ASN stays cancelled
inbound-receivingASNCancelled, warehouse.inbound-receiving.eventsasn_numberMarks the ASN cancelled in AsnView; policy CancelWhenAllAsnsCancelled cancels an INBOUND BOOKED appointment whose ASNs are all cancelled, reason ASN_CANCELLEDA cancelled appointment is skipped
process-path-managementCPTScheduleChanged, warehouse.process-path-management.eventssite_id, timezone, cutoffsStores the schedule in CutoffView (cutoff_schedules, cutoffs). Phase 2, not built: policy PickupFromCutoffs would keep OUTBOUND appointments; today no appointment is created from it (D-3)The whole schedule of a site replaces the previous one; the event has no version, the inbox claim makes a replay a no-op

The legacy importer that once read this topic under its own group was removed in dock-scheduling ADR 0011 (stage E of inbound-receiving ADR 0019): this context consumes no inbound-receiving dockappointment.* type. The provenance field of DockAppointmentBooked still admits legacy-import (a published enum value, kept as a historical value that nothing sets).

Derived from: model.yaml → contexts[dock-scheduling].consumes, .policies, .read_models, and the data of the producers' events in contexts[yard-management].publishes. The consumed data of yard-management events is printed on its Domain Events page.

Notes​

The gaps this page used to list are closed by the service's decisions (see the Model Gap Register):

  • The arrival tolerance that yard-management needs reaches it on DockAppointmentBooked and DockAppointmentRescheduled as arrival_tolerance_minutes (X1, DS-G01).
  • VisitRejected is consumed here (policy CancelOnVisitRejected, X2, DS-G02), and also read by exception-management.
  • DockAppointmentAtRisk has no version; clients read atRisk and atRiskCause from the appointment, and GET /appointments takes an atRisk filter (D-6, DS-G11).
  • inbound-receiving keeps its appointments copy from DockAppointmentBooked, Rescheduled, Cancelled and, since ADR 0010, DockAppointmentDoorReassigned. It does not need NoShow (X7, DS-G14).
  • outbound-shipping also reads DockAppointmentBooked.