Skip to main content

Events

Summary of apis/asyncapi.yaml (AsyncAPI 2.6.0, version 0.5.0). The file is the authority for payload fields.

Analytics stream (ADR 0005)​

The five CapacityPlan events below are ALSO written to warehouse.warehouse-planning.analytics in the same outbox transaction, with the same type and id and dataschema=urn:warehouse:warehouse-planning:analytics:<EventName>:v1. The analytics payloads equal the integration payloads plus additive analytics-only fields: CapacityPlanPublished.data.binding_constraint (the constraint type binding the bottleneck step; "" when unknown). Only this service's planning-projector consumes the topic; poison messages go to warehouse.warehouse-planning.analytics.dlq.

Envelope​

Every message, published or consumed, is a CloudEvents 1.0 event in structured content mode with the Kafka header content-type: application/cloudevents+json; charset=UTF-8. There is no flat envelope and no toggle. Events this service publishes also carry the optional W3C trace headers (traceparent, and tracestate / baggage when present) of the request that wrote the outbox row (ADR 0014); consumers may extract them and must not require them.

AttributeValue
specversion1.0
idUUID v4 minted once per domain event and persisted with the outbox row; consumers dedupe on it
source/warehouse/warehouse-planning
typecom.warehouse.wes.warehouse-planning.<entity>.<EventName> (<entity> is capacityplan or processcapacity)
subjectthe aggregate instance id (the capacity plan id, or <process_type>/<location>/<window_start>/<window_end>); also the Kafka key
timedomain occurred-at, UTC
datacontenttypeapplication/json
dataschemaurn:warehouse:warehouse-planning:events:<EventName>:v1

A breaking payload change gets a new .v2 type and dataschema; an existing one is never mutated.

Published​

Topic warehouse.warehouse-planning.events, written by the outbox relay.

Type suffix (after com.warehouse.wes.warehouse-planning.capacityplan.)RaisedPayload (data)
CapacityPlanCreatedPOST /capacity-plansplan_id, warehouse_id, location, path_id, window_start, window_end, assigned_demand, path_capacity, capacity_over_window, shortage, bottleneck_step, status (always DRAFT)
CapacityPlanPublishedplan publicationthe same fields except status, plus published_at
CapacityShortageDetectedpublication, only when shortage > 0plan_id, warehouse_id, location, path_id, window_start, window_end, assigned_demand, capacity_over_window, shortage, bottleneck_step
BottleneckDetectedpublication, only when shortage > 0plan_id, warehouse_id, location, path_id, window_start, window_end, bottleneck_step, path_capacity
CapacityPlanSupersededpublication, only when another plan of the same site_id, location, path_id and window was PUBLISHED; queued BEFORE the newer plan's CapacityPlanPublished; subject and key are the OLDER plan (ADR 0024)plan_id (the older plan), superseded_by, warehouse_id, site_id, location, path_id, window_start, window_end

Each plan-event occurrence is also written once more to the analytics topic (see "Analytics stream" above).

ProcessCapacity publishes on the same topic, suffix after com.warehouse.wes.warehouse-planning.processcapacity.; subject and the Kafka key are <process_type>/<location>/<window_start>/<window_end>. No analytics copy: the analytics stream is plan facts only.

Type suffix (after com.warehouse.wes.warehouse-planning.processcapacity.)RaisedPayload (data)
ProcessCapacityRegisteredPOST /process-capacities / MCP / labor consumer — the FIRST constraint of a process, location and windowprocess_type, location, window_start, window_end, constraint_type, quantity, unit, period_seconds
ProcessCapacityChangeda later registration that moves the effective rate (value, binding, or both)process_type, location, window_start, window_end, constraint_type, previous_quantity, previous_unit, previous_period_seconds, previous_binding_constraint, effective_quantity, effective_unit, effective_period_seconds, effective_binding_constraint

Consumed​

TypeTopicProducerConsumer group env var
com.warehouse.wes.workforce-management.shiftplan.ShiftPlanCommittedwarehouse.workforce.eventsworkforce-managementLABOR_CAPACITY_CONSUMER_GROUP
com.warehouse.wms.facility-layout.locationslot.LocationSlotRegisteredwarehouse.facility.eventsfacility-layoutSTORAGE_CAPACITY_CONSUMER_GROUP
com.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissionedwarehouse.facility.eventsfacility-layoutSTORAGE_CAPACITY_CONSUMER_GROUP
com.warehouse.wes.order-management.order.OrderAllocatedwarehouse.order-management.eventsorder-managementDEMAND_CONSUMER_GROUP (required, always consumed)
com.warehouse.wes.order-management.order.OrderPartiallyAllocatedwarehouse.order-management.eventsorder-managementDEMAND_CONSUMER_GROUP (required, always consumed)
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentBookedwarehouse.dock-scheduling.eventsdock-schedulingDOCK_APPOINTMENT_CONSUMER_GROUP (required, always consumed)
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentRescheduledwarehouse.dock-scheduling.eventsdock-schedulingDOCK_APPOINTMENT_CONSUMER_GROUP (required, always consumed)
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentCancelledwarehouse.dock-scheduling.eventsdock-schedulingDOCK_APPOINTMENT_CONSUMER_GROUP (required, always consumed)
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentNoShowwarehouse.dock-scheduling.eventsdock-schedulingDOCK_APPOINTMENT_CONSUMER_GROUP (required, always consumed)
com.warehouse.wes.fulfillment-execution.task.TaskCompletedwarehouse.fulfillment.eventsfulfillment-executionOBSERVED_CAPACITY_CONSUMER_GROUP (required, always consumed)

The two order-management types feed the expected-demand read model (GET /demand, MCP get_expected_demand, and the default of assigned_demand on POST /capacity-plans); every other type on that topic, OrderRepromised included, is ignored. See docs/adr/0004-demand-ingestion-from-order-management.md.

The four dock-scheduling appointment types feed the inbound-demand read model (GET /inbound-demand, MCP get_inbound_demand, the inbound_* fields of a capacity plan). Only INBOUND appointments count, each at the site_id of its events; a Rescheduled moves the demand, a Cancelled or NoShow removes it, and the aggregate version makes the arrival order irrelevant. The labour comes from the operator-declared inbound labour standard, not from the event. The inbound-receiving appointment types are no longer consumed (ADR 0020). TaskCompleted feeds the observed-capacity read model behind the advisory GET /capacity-plans/{id}/variance. Every other type on those two topics is ignored. See ADR 0017.

A transiently failing message on any of the six consumed topics is retried up to 5 times and then published to <topic>.dlq (warehouse.workforce.events.dlq, warehouse.facility.events.dlq, warehouse.order-management.events.dlq, warehouse.dock-scheduling.events.dlq, warehouse.fulfillment.events.dlq) with x-dlq-* headers (ADR 0007).

What each consumed event changes is described on Upstream contracts; the DDD view of every event (producer use case, partition key, known consumers) is on Domain events.

Example​

A CapacityShortageDetected event from the spec (12000 orders assigned, 8000 orders of capacity, bound by REBIN):

{
"specversion": "1.0",
"id": "3b2a1c0d-9e8f-4d7c-b6a5-4f3e2d1c0b9a",
"source": "/warehouse/warehouse-planning",
"type": "com.warehouse.wes.warehouse-planning.capacityplan.CapacityShortageDetected",
"subject": "0b7a4c1e-5d52-4f0e-9a39-6c1f2f3a8b10",
"time": "2026-10-04T21:45:10Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:warehouse-planning:events:CapacityShortageDetected:v1",
"data": {
"plan_id": "0b7a4c1e-5d52-4f0e-9a39-6c1f2f3a8b10",
"warehouse_id": "WH-1",
"location": "PATH-ZONE-A",
"path_id": "pick-rebin-pack",
"window_start": "2026-10-05T08:00:00Z",
"window_end": "2026-10-05T16:00:00Z",
"assigned_demand": 12000,
"capacity_over_window": 8000,
"shortage": 4000,
"bottleneck_step": "REBIN"
}
}

The full spec is at apis/asyncapi.yaml.