Skip to main content

Integration

All integration is asynchronous over Kafka (CloudEvents 1.0, structured JSON, one broker platform-wide) plus this service's own unauthenticated REST and MCP APIs. dock-scheduling calls no other service synchronously: it keeps small event-fed local copies instead and validates bookings against them.

Source: internal/adapters/inbound/kafka/*, internal/adapters/outbound/kafka/encoder.go, apis/asyncapi.yaml, ADR 0003, ADR 0004, ADR 0009; the consumers' side in the neighbours' own repositories (origin/develop) and the yard context map in the central documentation site.

Neighbour patterns follow the yard context map: the yard and facility feeds are customer/supplier or conformist upstreams, and this service conforms to the upstream's payloads (it never negotiates them).

Upstreams (this service consumes)​

UpstreamTopicEvent types consumedEffectPattern
yard-managementwarehouse.yard-management.eventscom.warehouse.wms.yard-management.yardvisit.VisitCheckedInApplies the arrival: BOOKED to CHECKED_IN with an arrival status (early, on time, late).Customer/Supplier
...yardvisit.VisitRejectedCancels the BOOKED appointment with reason TURNED_AWAY.
...trailer.TrailerDockedDoor at which the trailer really docked wins: the appointment's door is changed (no overlap refusal), later overlapping appointments are flagged at risk (DOOR_REASSIGNED_OVERLAP), DockAppointmentDoorReassigned is published.
...trailer.TrailerUndockedCompletes the appointment (an implicit arrival if it was still BOOKED).
facility-layoutwarehouse.facility.eventscom.warehouse.wms.facility-layout.zone.ZoneRegistered, ...locationslot.LocationSlotRegistered, ...locationslot.LocationSlotDecommissionedMaintains the zones and doors copies: a door's site (through its zone), dock flow and active flag.Conformist
inbound-receivingwarehouse.inbound-receiving.eventscom.warehouse.wms.inbound-receiving.asn.ASNRegistered, ...asn.ASNCancelledMaintains the asns copy; an ASN cancellation cancels an INBOUND BOOKED appointment whose ASNs are now all cancelled (reason ASN_CANCELLED).Conformist
process-path-managementwarehouse.process-path-management.eventscom.warehouse.wes.process-path-management.cptschedule.CPTScheduleChangedReplaces the site's cutoff copy (the whole schedule): outbound bookings validate cptId against it.Conformist

Behaviour common to every consumer (internal/adapters/inbound/kafka/kafka.go, consumer.go):

  • Decode CloudEvents 1.0 only and dispatch on the full type string. A message that is not a valid CloudEvent is logged and committed past; an unhandled type is ignored.
  • Every effect is a use case that claims the CloudEvents id in processed_events inside the same transaction as the effect: redelivery changes nothing.
  • A message of a handled type that can never be applied (undecodable payload, missing id, a value the domain refuses) is republished to <topic>.dlq with x-dlq-source-topic and x-dlq-cause, then committed past.
  • A transient failure (Postgres down, concurrent update) is retried on the same message with capped exponential backoff, forever; the partition waits.
  • Facts the policies deliberately do not apply (unknown or terminal appointment, door not yet known, another site) are counted in dock_scheduling_ignored_facts_total{reason} and marked processed.
  • Yard facts are keyed by visit or trailer, not by appointment, so they can arrive in any order; a door release on a BOOKED appointment completes it and records the arrival as implicit.
  • A new consumer group starts at the first offset and replays; the local copies converge.

Downstreams (consume this service's events)​

Topic warehouse.dock-scheduling.events, key = appointment id (site id for calendar events, SCAC for carrier events), source /warehouse/dock-scheduling, dataschema urn:warehouse:dock-scheduling:events:<Event>:v1. Published through the transactional outbox, at-least-once, the CloudEvents id persisted at enqueue time.

DownstreamEvent types it consumes (from its own consumer code on origin/develop)Use
yard-managementDockAppointmentBooked, DockAppointmentRescheduled, DockAppointmentCancelled, DockAppointmentNoShow, DoorClosureScheduled, DoorClosureLifted, CarrierRegistered, CarrierSuspended, CarrierReinstatedExpected arrivals and the door calendar; a no-show frees the open move; the carrier events feed its CarrierView copy of the carrier registry (ADR 0012).
inbound-receivingDockAppointmentBooked, DockAppointmentRescheduled, DockAppointmentCancelled, DockAppointmentDoorReassignedIts appointments local copy (its ADR 0019): validates a receipt's appointment and stamps the physical door.
warehouse-planningDockAppointmentBooked, DockAppointmentRescheduled, DockAppointmentCancelled, DockAppointmentNoShow (per the yard context map; its ADR 0020)Inbound labour demand per site, replacing the old inbound-receiving source.
outbound-shippingDockAppointmentBookedOutbound appointment awareness.
exception-managementDockAppointmentNoShowOpens a case.

Not on this topic: DockAppointmentCheckedIn, DockAppointmentCompleted, DockAppointmentAtRisk and DoorOperatingHoursDeclared are analytics only (warehouse.dock-scheduling.analytics, consumed by this service's own projector, not an integration contract). See Events for the full catalogue. Several neighbours mention CheckedIn or Completed in comments to say it is analytics only; none receives it.

Failure behaviour for consumers is each consumer's own (retry, dead-letter warehouse.dock-scheduling.events.dlq); on the producer side a failing row is retried by the relay up to OUTBOX_MAX_ATTEMPTS, then excluded and logged (see the Runbook). Delivery is at-least-once: consumers must dedupe on the CloudEvents id.

Synchronous interfaces​

ClientInterfaceNotes
Carrier schedulers, dock planners, consoles, other contextsREST on cmd/api (/api/dock-scheduling behind Kong)OpenAPI apis/openapi.yaml; unauthenticated; the gateway adds no auth.
AgentsMCP on cmd/mcp (/api/mcp/dock-scheduling behind Kong)Five read tools, four L3 write tools; see MCP tools. Not running on k3s (switched off in warehouse-infra, read 2026-11-10): no pod, no route.
Report readersREST on cmd/reports (/api/dock-scheduling/reports behind Kong)apis/openapi-reports.yaml; reads the analytical database only. Not running on k3s (analytics switched off, read 2026-11-10): no pod, no route.
Kubernetes CronJobPOST /no-show-sweeps via cmd/sweepThe only timer; nothing in the service calls the endpoint itself. Switched off on k3s (read 2026-11-10): no CronJob exists, so the endpoint is called by hand.

Edge status​

Read-only on 2026-11-10 (kubectl get pods,deploy -n warehouse-systems, context k3s-multipass). An edge is live only when both ends run in the cluster and the consumer or producer code and the spec declare it. dock-scheduling is applied (Argo application Synced and Healthy, api pod Ready at v0.1.2; see the Runbook), so an edge is live when the neighbour also runs. The consumer groups are those of the warehouse-infra helm values (helm-values/dock-scheduling.yaml and the neighbour's own file) and of the running Deployments' environment. "Live" here means both ends run and declare the edge; it does not say events flow without lag: consumer group offsets and lag need kubectl exec and were not read.

EdgeDirectionConsumer groupNeighbour in the cluster (image running)Status
yard-managementin: warehouse.yard-management.eventsdock-scheduling-yardyard-management api and yard-management-relay Ready (da1e30e, v0.1.2)live
yard-managementout: warehouse.dock-scheduling.eventsyard-management-dock-schedulingsame pods; the consumer is in its apilive
facility-layoutin: warehouse.facility.eventsdock-scheduling-facilityfacility-layout Ready (1305245)live
inbound-receivingin: warehouse.inbound-receiving.eventsdock-scheduling-asninbound-receiving Ready (484490f, v2.0.6)live
inbound-receivingout: warehouse.dock-scheduling.eventsinbound-receiving-dock-appointmentssame pod; dock_appointment_consumer.go at 484490flive
process-path-managementin: warehouse.process-path-management.eventsdock-scheduling-cptprocess-path-management Ready (a336eaf)live
warehouse-planningout: warehouse.dock-scheduling.eventswarehouse-planning-dock-appointmentswarehouse-planning Ready (ef8b946); dock_appointment_consumer.golive
exception-managementout: warehouse.dock-scheduling.eventsexception-management-dock-schedulingexception-management Ready (35bb7d9); dock_scheduling_exceptions_consumer.go; the Deployment carries DOCK_SCHEDULING_EXCEPTIONS_CONSUMER_GROUPlive
outbound-shippingout: warehouse.dock-scheduling.eventsnone: no warehouse-infra entry or helm values found for itno pod (kubectl get deploy outbound-shipping: NotFound)not live, not registered in infra

The consumers' side of these rows (the event types a neighbour reads) comes from the neighbours' own code and specs at the commit each pod runs (the image tag is that commit), as the tables above say; the group and neighbour columns come from warehouse-infra origin/develop and the cluster listing. The exception-management row was "not wired in infra" until the exception-management group ids were pinned (warehouse-infra commit a703971, 2026-11-09); the running Deployment now carries it.

Not verified: the offsets and lag of every group, whether the topics hold the events a consumer expects, and delivery from this service's outbox. The api log of the dock pod shows kafka reader error; retrying lines with i/o timeout on the yard, facility, inbound-receiving and process-path-management topics at 23:21Z on 2026-11-10 (quoted in the Runbook); they were not diagnosed.

Edges that do not exist​

  • No outbound calls. This service calls no sibling over REST, MCP or A2A; there is no HTTP client in cmd/api. A booking that needs a door, ASN or cutoff the copies do not hold is refused (unknown-door, unknown-asn, missing-outbound-ref), never looked up synchronously.
  • No A2A server (cmd/a2a does not exist).
  • No ETA feed. transport-visibility does not exist; ETAs enter through POST .../eta-reports and the report_eta MCP tool.
  • No automatic pickup booking from the CPT schedule (PickupFromCutoffs is phase 2): the cutoff copy is stored and used only to validate cptId.
  • No retail-network edge. No retailnetwork.* topic is consumed and no retail-network service is called.
  • No legacy appointment feed. The stage A importer of the ADR 0019 strangler was removed (ADR 0011): this context consumes no inbound-receiving dockappointment.* type, only the two ASN events.

Where the Helm chart or OpenAPI mention a "kind" cluster (servers in apis/openapi.yaml, the image comment in values.yaml) they predate the move to k3s; the contract itself is unaffected.