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.
| Attribute | Value |
|---|---|
specversion | 1.0 |
id | UUID v4 minted once per domain event and persisted with the outbox row; consumers dedupe on it |
source | /warehouse/warehouse-planning |
type | com.warehouse.wes.warehouse-planning.<entity>.<EventName> (<entity> is capacityplan or processcapacity) |
subject | the aggregate instance id (the capacity plan id, or <process_type>/<location>/<window_start>/<window_end>); also the Kafka key |
time | domain occurred-at, UTC |
datacontenttype | application/json |
dataschema | urn: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.) | Raised | Payload (data) |
|---|---|---|
CapacityPlanCreated | POST /capacity-plans | plan_id, warehouse_id, location, path_id, window_start, window_end, assigned_demand, path_capacity, capacity_over_window, shortage, bottleneck_step, status (always DRAFT) |
CapacityPlanPublished | plan publication | the same fields except status, plus published_at |
CapacityShortageDetected | publication, only when shortage > 0 | plan_id, warehouse_id, location, path_id, window_start, window_end, assigned_demand, capacity_over_window, shortage, bottleneck_step |
BottleneckDetected | publication, only when shortage > 0 | plan_id, warehouse_id, location, path_id, window_start, window_end, bottleneck_step, path_capacity |
CapacityPlanSuperseded | publication, 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.) | Raised | Payload (data) |
|---|---|---|
ProcessCapacityRegistered | POST /process-capacities / MCP / labor consumer — the FIRST constraint of a process, location and window | process_type, location, window_start, window_end, constraint_type, quantity, unit, period_seconds |
ProcessCapacityChanged | a 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
| Type | Topic | Producer | Consumer group env var |
|---|---|---|---|
com.warehouse.wes.workforce-management.shiftplan.ShiftPlanCommitted | warehouse.workforce.events | workforce-management | LABOR_CAPACITY_CONSUMER_GROUP |
com.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered | warehouse.facility.events | facility-layout | STORAGE_CAPACITY_CONSUMER_GROUP |
com.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissioned | warehouse.facility.events | facility-layout | STORAGE_CAPACITY_CONSUMER_GROUP |
com.warehouse.wes.order-management.order.OrderAllocated | warehouse.order-management.events | order-management | DEMAND_CONSUMER_GROUP (required, always consumed) |
com.warehouse.wes.order-management.order.OrderPartiallyAllocated | warehouse.order-management.events | order-management | DEMAND_CONSUMER_GROUP (required, always consumed) |
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentBooked | warehouse.dock-scheduling.events | dock-scheduling | DOCK_APPOINTMENT_CONSUMER_GROUP (required, always consumed) |
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentRescheduled | warehouse.dock-scheduling.events | dock-scheduling | DOCK_APPOINTMENT_CONSUMER_GROUP (required, always consumed) |
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentCancelled | warehouse.dock-scheduling.events | dock-scheduling | DOCK_APPOINTMENT_CONSUMER_GROUP (required, always consumed) |
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentNoShow | warehouse.dock-scheduling.events | dock-scheduling | DOCK_APPOINTMENT_CONSUMER_GROUP (required, always consumed) |
com.warehouse.wes.fulfillment-execution.task.TaskCompleted | warehouse.fulfillment.events | fulfillment-execution | OBSERVED_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.