Skip to main content

Domain events

Every event this context publishes or consumes, with the full CloudEvents type. The contract is apis/asyncapi.yaml; the envelope (specversion 1.0, id, source, type, subject, time, datacontenttype application/json, dataschema) is built only by internal/adapters/kafka/cloudevents. Payload fields are snake_case and timestamps are RFC 3339 UTC.

Published​

dataschema is urn:warehouse:pick-face-replenishment:<events|analytics>:<EventName>:v1; source is /warehouse/pick-face-replenishment; the Kafka header content-type is application/cloudevents+json; charset=UTF-8.

EventFull typeTopicsKey and subjectRaised by
ReplenishmentRequestedcom.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentRequestedwarehouse.pick-face-replenishment.events, warehouse.pick-face-replenishment.analyticsrequest idRequest.Plan via the Evaluator, RaiseManualRequest, EvaluateSite, ApplyBinLevel, ApplyForwardAssignmentMap
ReplenishmentCompletedcom.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentCompletedevents + analyticsrequest idRequest.Complete via ApplyRelocation
ReplenishmentCancelledcom.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentCancelledevents + analyticsrequest idRequest.Cancel via CancelRequest, RemovePolicy, ApplyForwardAssignmentMap
ReplenishmentPolicyDeclaredcom.warehouse.wms.pick-face-replenishment.policy.ReplenishmentPolicyDeclaredanalytics only<site_id>/<sku>DeclarePolicy

Payloads​

Eventdata fields
ReplenishmentRequestedrequest_id, site_id, sku, forward_bin, source_bin, quantity (at least 1), priority (NORMAL or URGENT), policy_min, policy_max, requested_at
ReplenishmentCompletedrequest_id, site_id, sku, forward_bin, source_bin, quantity (what the relocation moved, possibly less than requested), completed_at
ReplenishmentCancelledrequest_id, site_id, sku, reason (OPERATOR, ASSIGNMENT_CHANGED, POLICY_REMOVED), cancelled_at
ReplenishmentPolicyDeclaredsite_id, sku, min_qty, max_qty, multiple, multiple_source (optional, DECLARED or PACK_DERIVED), version, declared_at

Both topics carry the same type and the same CloudEvents id per occurrence, written in one outbox transaction. A breaking payload change would be a new .v2 type and dataschema, never a mutation of v1. Golden files pin the exact bytes (internal/adapters/outbound/events/testdata/).

Consumers of the published events: wes-work-planning reads ReplenishmentRequested and ReplenishmentCancelled from warehouse.pick-face-replenishment.events when REPLENISHMENT_MODE=kafka (its ADR 0042; it ignores ReplenishmentCompleted, and the default permissive consumes nothing); warehouse-infra sets it on wes-work-planning. The analytics topic is read only by this repository's cmd/pfr-projector (ADR 0008), which is enabled in warehouse-infra helm values (analytics.enabled: true in helm-values/pick-face-replenishment.yaml; cluster state was not checked) - see Integration.

Consumed​

Full typeTopicKeyFields usedHandler
com.warehouse.wms.inventory-storage.stock.BinStockLevelChangedwarehouse.inventory.events<bin>:<sku>site_code, bin, sku, on_hand, reserved, versioninventory consumer, ApplyBinLevel
com.warehouse.wms.inventory-storage.stock.StockRelocatedwarehouse.inventory.eventsrelocation_idrelocation_id, site_code, sku, from_bin, to_bin, quantity, reason, source_refinventory consumer, ApplyRelocation
com.warehouse.wms.slotting-optimization.slotplan.SlotPlanApprovedwarehouse.slotting-optimization.eventsplan idplan_id, site_id, approved_at, assignments[{sku, slot}]slotting consumer, ApplyForwardAssignmentMap
com.warehouse.wms.facility-layout.zone.ZoneRegisteredwarehouse.facility.eventszoneIdzoneId, siteCode, zoneCodelayout consumer, ApplyZone
com.warehouse.wms.facility-layout.locationslot.LocationSlotRegisteredwarehouse.facility.eventslocationCodelocationCode, zoneId, rolelayout consumer, ApplyLocationRegistered
com.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissionedwarehouse.facility.eventslocationCodelocationCodelayout consumer, ApplyLocationDecommissioned
com.warehouse.wms.product-master.product.ProductPackLevelDeclaredwarehouse.product-master.eventsSKUsku, level, gtin, units_per_pack, effective_from, versionproduct-master consumer, ApplyPackLevelDeclared
com.warehouse.wms.product-master.product.ProductPackLevelRetiredwarehouse.product-master.eventsSKUsku, level, gtin, effective_to, versionproduct-master consumer, ApplyPackLevelRetired

Eight types are consumed, from four topics (apis/asyncapi.yaml). The payloads of consumed events are restated here from the producers' contracts, never imported; fields not listed are ignored. For the two pack-level types the key names in the table are the snake_case keys product-master's encoder writes and this service decodes (internal/adapters/inbound/kafka/productmaster_consumer.go). Producer status of each type is on Integration.

Example: ReplenishmentRequested​

{
"specversion": "1.0",
"id": "6f1d2c3b-4a5e-4b7c-8d9e-0a1b2c3d4e5f",
"source": "/warehouse/pick-face-replenishment",
"type": "com.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentRequested",
"subject": "repl-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07",
"time": "2026-10-17T09:30:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:pick-face-replenishment:events:ReplenishmentRequested:v1",
"data": {
"request_id": "repl-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07",
"site_id": "WH1",
"sku": "SKU-1",
"forward_bin": "WH1-FWD-A01-01-01-A",
"source_bin": "WH1-RSV-A07-03-02-B",
"quantity": 24,
"priority": "NORMAL",
"policy_min": 10,
"policy_max": 60,
"requested_at": "2026-10-17T09:30:00Z"
}
}

This is the example from apis/asyncapi.yaml.