slotting-optimization Domain Events 1.0.0

Event catalog for the slotting-optimization bounded context (WMS subdomain): reviewable plans that assign SKUs to forward pick slots, and the human decision taken on them (ADR 0001, ADR 0002).

Published. The SlotPlan aggregate raises three events, published to warehouse.slotting-optimization.events through a transactional outbox: the plan row and its already-encoded events are written in ONE database transaction and a relay drains them to Kafka (at-least-once; the CloudEvents id is stored with the outbox row, so a retry republishes the same id). SlotPlanApproved carries the FULL forward assignment map and the moves, so a consumer needs no lookup; supersedes_plan_id names the previously Approved plan of the site, if any.

Consumed (ADR 0003, ADR 0010, ADR 0012). SiteSkuDemandChanged from order-management; ProductClassified, ProductDimensionsDeclared, ProductMeasured and the three ProductPackLevel* events from product-master; ZoneRegistered, LocationSlotRegistered and LocationSlotDecommissioned from facility-layout; StockRelocated from inventory-storage. Each feeds a durable local copy. Five consumers always run on real Kafka (env DEMAND_MODE, PRODUCT_MODE, LAYOUT_MODE, RELOCATION_MODE, PACK_LEVEL_MODE; the only accepted value, and the default, is kafka: permissive and off are refused at boot) and each needs its consumer group (DEMAND_CONSUMER_GROUP, PRODUCT_CONSUMER_GROUP, LAYOUT_CONSUMER_GROUP, RELOCATION_CONSUMER_GROUP, PACK_LEVEL_CONSUMER_GROUP; boot fails without it). A message that is not a valid CloudEvent, or whose type is not handled, is skipped. A transient failure retries the same message up to 5 attempts, then the message goes to <topic>.dlq with x-dlq-* headers. A handled event whose payload can never be applied is skipped with a WARN, except for StockRelocated and the ProductPackLevel* events, which are dead-lettered at once. The consumed messages below are the producers' own contracts, decoded independently here and never imported.

Analytics (ADR 0006). The same three events are ALSO published, in the same transaction and under the same id per occurrence, to warehouse.slotting-optimization.analytics with dataschema urn:warehouse:slotting-optimization:analytics:<EventName>:v1. That stream is not an integration contract: only this service's own projector (cmd/slotting-projector, consumer group from ANALYTICS_CONSUMER_GROUP) consumes it, folding it into the slot-plan funnel read model; cmd/slotting-reports serves the report. Other contexts keep reading warehouse.slotting-optimization.events.

Envelope (mandatory). CloudEvents 1.0, structured content mode, Kafka header content-type: application/cloudevents+json; charset=UTF-8. Optional W3C trace-context headers (traceparent, and tracestate / baggage when present) carry the trace of the request that wrote the outbox row (ADR 0009); consumers may extract them, and must not require them. specversion, id, source (/warehouse/slotting-optimization), type, subject (the plan id), time, datacontenttype (application/json) and dataschema (urn:warehouse:slotting-optimization:<events|analytics>:<EventName>:v1) are all required. Kafka key = the plan id. Type = com.warehouse.wms.slotting-optimization.slotplan.<EventName>. A breaking payload change is a new .v2 type, never a mutation.

  • #slotting-optimization
  • #slotplan
  • #consumed
  • #analytics

Servers

  • {brokers}kafkaproduction

    Fleet-shared Kafka broker (host supplied by the deployment environment).

    object
    string
    required
    Security:
    security.protocol:PLAINTEXT

Operations

  • SUB warehouse.slotting-optimization.events

    This service's integration topic. Written by the outbox relay; key = plan id; every message carries the CloudEvents content-type header (plus the optional W3C traceparent of the writing request, ADR 0009). Dispatch on the full type, ignore unknown types, dedupe on id. A row the relay excluded after OUTBOX_MAX_ATTEMPTS failures (ADR 0008) is overtaken by later events of the same plan.

    Receive SlotPlan events.

    Subscribe to the slotting decisions. Route on the full type (com.warehouse.wms.slotting-optimization.slotplan.<EventName>). Only SlotPlanApproved changes the published forward-slot picture.

    Operation IDreceiveSlotPlanEvents

    Available only on servers:

    • #slotplan

    Accepts one of the following messages:

    • #0Slot plan generated

      A Draft slot plan was generated.

      type = com.warehouse.wms.slotting-optimization.slotplan.SlotPlanGenerated; subject and key = the plan id. Sizes only; the assignments are not part of this event.

      allOf
      • #slotplan

      Examples

    • #1Slot plan approved

      A Draft slot plan was approved; it is now the site's forward-slot map.

      type = com.warehouse.wms.slotting-optimization.slotplan.SlotPlanApproved; subject and key = the plan id. assignments is the FULL map of the plan (replace your picture of the site's forward slots from it); moves is what changes against the previous map. kind is Assign, Relocate or Vacate; a Vacate omits to_slot and sets from_slot, an Assign omits from_slot. supersedes_plan_id is omitted when the site had no Approved plan.

      allOf
      • #slotplan

      Examples

    • #2Slot plan rejected

      A Draft slot plan was rejected.

      type = com.warehouse.wms.slotting-optimization.slotplan.SlotPlanRejected; subject and key = the plan id. reason is omitted when none was given.

      allOf
      • #slotplan

      Examples

  • SUB warehouse.slotting-optimization.analytics

    This service's own analytics stream (ADR 0006), written by the SAME transactional outbox as the integration topic: every published event appears here too, under the SAME CloudEvents id and type, with only the dataschema stream segment different (urn:warehouse:slotting-optimization:analytics::v1). It is NOT an integration contract: the only consumer is this service's cmd/slotting-projector (fixed group from ANALYTICS_CONSUMER_GROUP), which folds the events into the analytical database; its deterministic poison goes to warehouse.slotting-optimization.analytics.dlq. Other contexts keep reading warehouse.slotting-optimization.events.

    Receive the analytics twin of every SlotPlan event.

    Payloads are byte-for-byte the integration payloads (ADR 0006 section 2); only the dataschema names the analytics stream.

    Operation IDreceiveSlotPlanAnalytics

    Available only on servers:

    • #analytics

    Accepts one of the following messages:

    • #0Slot plan generated (analytics twin)

      The analytics-stream twin of SlotPlanGenerated (ADR 0006).

      Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:slotting-optimization:analytics:SlotPlanGenerated:v1. Consumed only by cmd/slotting-projector.

      allOf
      • #analytics

      Examples

    • #1Slot plan approved (analytics twin)

      The analytics-stream twin of SlotPlanApproved (ADR 0006).

      Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:slotting-optimization:analytics:SlotPlanApproved:v1. The supersedes_plan_id, when present, stamps the SUPERSEDED plan's supersession day in the read model.

      allOf
      • #analytics

      Examples

    • #2Slot plan rejected (analytics twin)

      The analytics-stream twin of SlotPlanRejected (ADR 0006).

      Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:slotting-optimization:analytics:SlotPlanRejected:v1.

      allOf
      • #analytics

      Examples

  • PUB warehouse.order-management.events

    order-management's integration topic. This service consumes ONLY SiteSkuDemandChanged (key <order>/line/<n>, so one line's stream is totally ordered), under a stable consumer group read from env DEMAND_CONSUMER_GROUP when DEMAND_MODE=kafka. Every other type on the topic is ignored.

    Consume the per-line site/SKU demand projection.

    Last writer wins per source order line; state=REMOVED deactivates the line. The CloudEvents id claim and the effect commit in one transaction; the offset is committed afterwards (ADR 0003).

    Operation IDconsumeSiteSkuDemand

    Available only on servers:

    • #consumed

    Accepts the following message:

    SiteSkuDemandChanged (consumed, order-management)

    One source order line's demand at the configured site changed.

    type = com.warehouse.wes.order-management.siteskudemand.SiteSkuDemandChanged, source /warehouse/order-management, dataschema urn:warehouse:order-management:events:SiteSkuDemandChanged:v1. Subject and Kafka key = <source_order_id>/line/<line_no>. Produced by order-management (its ADR 0035).

    allOf
    • #consumed

    Examples

  • PUB warehouse.product-master.events

    product-master's integration topic (key and subject = the SKU). This service consumes ProductClassified, ProductDimensionsDeclared and ProductMeasured under a stable consumer group read from env PRODUCT_CONSUMER_GROUP when PRODUCT_MODE=kafka, and ProductPackLevelDeclared, ProductPackLevelRetired and ProductPackLevelMeasured into its local PackLevelView (ADR 0012) under PACK_LEVEL_CONSUMER_GROUP when PACK_LEVEL_MODE=kafka. A message is applied only when its version is greater than the stored one. Every other type is ignored.

    Consume product classification and physical profile events.

    Full-state per concern: a classification replaces the classification, a physical profile (declared or measured) replaces the physical profile, acting on effective.

    Operation IDconsumeProductMasterEvents

    Available only on servers:

    • #consumed

    Accepts one of the following messages:

    • #0ProductClassified (consumed, product-master)

      A product's handling classification was set or replaced (full state).

      type = com.warehouse.wms.product-master.product.ProductClassified, source /warehouse/product-master, dataschema urn:warehouse:product-master:events:ProductClassified:v1. Subject and key = the SKU. Applied only when version is greater than the stored one.

      allOf
      • #consumed

      Examples

    • #1ProductDimensionsDeclared (consumed, product-master)

      Declared unit dimensions and weight were set or replaced (full physical profile).

      type = com.warehouse.wms.product-master.product.ProductDimensionsDeclared, dataschema urn:warehouse:product-master:events:ProductDimensionsDeclared:v1. Act on effective and version.

      allOf
      • #consumed

      Examples

    • #2ProductMeasured (consumed, product-master)

      A measurement of one unit was recorded and is now effective (full physical profile).

      type = com.warehouse.wms.product-master.product.ProductMeasured, dataschema urn:warehouse:product-master:events:ProductMeasured:v1. Act on effective and version.

      allOf
      • #consumed

      Examples

    • #3ProductPackLevelDeclared (consumed, product-master)

      A pack level of a SKU was declared or revised.

      type = com.warehouse.wms.product-master.product.ProductPackLevelDeclared, source /warehouse/product-master, dataschema urn:warehouse:product-master:events:ProductPackLevelDeclared:v1. Subject and key = the SKU. Applied to the local PackLevelView (ADR 0012, PACK_LEVEL_MODE=kafka, group PACK_LEVEL_CONSUMER_GROUP) only when version is greater than the stored one. Payload pinned by product-master's apis/asyncapi.yaml on develop.

      object allOf

      CloudEvents 1.0 envelope of product-master's ProductPackLevelDeclared, as consumed here.

      • #consumed

      Examples

    • #4ProductPackLevelRetired (consumed, product-master)

      A pack level of a SKU was retired.

      type = com.warehouse.wms.product-master.product.ProductPackLevelRetired, source /warehouse/product-master, dataschema urn:warehouse:product-master:events:ProductPackLevelRetired:v1. Subject and key = the SKU. Applied to the local PackLevelView (ADR 0012, PACK_LEVEL_MODE=kafka, group PACK_LEVEL_CONSUMER_GROUP) only when version is greater than the stored one. Payload pinned by product-master's apis/asyncapi.yaml on develop.

      object allOf

      CloudEvents 1.0 envelope of product-master's ProductPackLevelRetired, as consumed here.

      • #consumed

      Examples

    • #5ProductPackLevelMeasured (consumed, product-master)

      A pack level of a SKU was physically measured.

      type = com.warehouse.wms.product-master.product.ProductPackLevelMeasured, source /warehouse/product-master, dataschema urn:warehouse:product-master:events:ProductPackLevelMeasured:v1. Subject and key = the SKU. Applied to the local PackLevelView (ADR 0012, PACK_LEVEL_MODE=kafka, group PACK_LEVEL_CONSUMER_GROUP) only when version is greater than the stored one. Payload pinned by product-master's apis/asyncapi.yaml on develop.

      object allOf

      CloudEvents 1.0 envelope of product-master's ProductPackLevelMeasured, as consumed here.

      • #consumed

      Examples

  • PUB warehouse.facility.events

    facility-layout's integration topic. This service consumes ZoneRegistered (key zoneId), LocationSlotRegistered and LocationSlotDecommissioned (key locationCode) under a stable consumer group read from env LAYOUT_CONSUMER_GROUP when LAYOUT_MODE=kafka. Every other type is ignored.

    Consume zones and location slots.

    A slot is joined to its zone through zoneId at plan time. An absent role on LocationSlotRegistered means Storage. Forward slots are the Storage slots in zones listed in FORWARD_ZONE_CODES (default FWD). Decommissioning removes the slot and is irreversible.

    Operation IDconsumeFacilityLayoutEvents

    Available only on servers:

    • #consumed

    Accepts one of the following messages:

    • #0ZoneRegistered (consumed, facility-layout)

      A behavioural zone was added inside a site's area.

      type = com.warehouse.wms.facility-layout.zone.ZoneRegistered, source /warehouse/facility-layout, dataschema urn:warehouse:facility-layout:events:ZoneRegistered:v1. Subject and Kafka key = zoneId. data also carries eventName, eventType and occurredAt, which are ignored.

      allOf
      • #consumed

      Examples

    • #1LocationSlotRegistered (consumed, facility-layout)

      A coded leaf slot now exists on the warehouse map.

      type = com.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered, dataschema urn:warehouse:facility-layout:events:LocationSlotRegistered:v1. Subject and Kafka key = locationCode. An absent role means Storage. data also carries eventName, eventType and occurredAt, which are ignored.

      allOf
      • #consumed

      Examples

    • #2LocationSlotDecommissioned (consumed, facility-layout)

      A coded slot was permanently retired.

      type = com.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissioned, dataschema urn:warehouse:facility-layout:events:LocationSlotDecommissioned:v1. Subject and Kafka key = locationCode. Irreversible: the slot is removed from the local copy.

      allOf
      • #consumed

      Examples

  • PUB warehouse.inventory.events

    inventory-storage's integration topic (its ADR 0039). This service consumes StockRelocated only (ADR 0010), under a stable consumer group read from env RELOCATION_CONSUMER_GROUP when RELOCATION_MODE=kafka, to record the execution progress of its slot plans. Every other type on the topic is ignored.

    Consume relocations to record slot-plan execution progress.

    A relocation is matched to a plan's move by source_ref first: the move reference <plan_id>:<move_seq> (fulfillment-execution's relocation_ref, carried by inventory-storage as the relocation's source_ref) names the move at that 0-based position of the plan's moves. Only when source_ref is no move reference is it matched by site_code, sku and the bins on the site's Approved plan. The CloudEvents id is claimed with the effect in one transaction; a relocation is recorded once per relocation_id. A relocation of no known move is claimed and counted, never dead-lettered. A StockRelocated whose data cannot be decoded or misses a required field is dead-lettered at once to warehouse.inventory.events.dlq.

    Operation IDconsumeInventoryStorageRelocations

    Available only on servers:

    • #consumed

    Accepts the following message:

    StockRelocated (consumed, inventory-storage)

    A quantity of one SKU moved from one bin to another bin of the same site.

    type = com.warehouse.wms.inventory-storage.stock.StockRelocated, dataschema urn:warehouse:inventory-storage:events:StockRelocated:v1. Subject and Kafka key = relocation_id. Restated from inventory-storage's contract (its ADR 0039), never imported.

    allOf
    • #consumed

    Examples

Messages

  • #1Slot plan generated

    A Draft slot plan was generated.

    Message IDSlotPlanGenerated

    type = com.warehouse.wms.slotting-optimization.slotplan.SlotPlanGenerated; subject and key = the plan id. Sizes only; the assignments are not part of this event.

    allOf
    • #slotplan
  • #2Slot plan approved

    A Draft slot plan was approved; it is now the site's forward-slot map.

    Message IDSlotPlanApproved

    type = com.warehouse.wms.slotting-optimization.slotplan.SlotPlanApproved; subject and key = the plan id. assignments is the FULL map of the plan (replace your picture of the site's forward slots from it); moves is what changes against the previous map. kind is Assign, Relocate or Vacate; a Vacate omits to_slot and sets from_slot, an Assign omits from_slot. supersedes_plan_id is omitted when the site had no Approved plan.

    allOf
    • #slotplan
  • #3Slot plan rejected

    A Draft slot plan was rejected.

    Message IDSlotPlanRejected

    type = com.warehouse.wms.slotting-optimization.slotplan.SlotPlanRejected; subject and key = the plan id. reason is omitted when none was given.

    allOf
    • #slotplan
  • #4SiteSkuDemandChanged (consumed, order-management)

    One source order line's demand at the configured site changed.

    Message IDSiteSkuDemandChanged

    type = com.warehouse.wes.order-management.siteskudemand.SiteSkuDemandChanged, source /warehouse/order-management, dataschema urn:warehouse:order-management:events:SiteSkuDemandChanged:v1. Subject and Kafka key = <source_order_id>/line/<line_no>. Produced by order-management (its ADR 0035).

    allOf
    • #consumed
  • #5ProductClassified (consumed, product-master)

    A product's handling classification was set or replaced (full state).

    Message IDProductClassified

    type = com.warehouse.wms.product-master.product.ProductClassified, source /warehouse/product-master, dataschema urn:warehouse:product-master:events:ProductClassified:v1. Subject and key = the SKU. Applied only when version is greater than the stored one.

    allOf
    • #consumed
  • #6ProductDimensionsDeclared (consumed, product-master)

    Declared unit dimensions and weight were set or replaced (full physical profile).

    Message IDProductDimensionsDeclared

    type = com.warehouse.wms.product-master.product.ProductDimensionsDeclared, dataschema urn:warehouse:product-master:events:ProductDimensionsDeclared:v1. Act on effective and version.

    allOf
    • #consumed
  • #7ProductMeasured (consumed, product-master)

    A measurement of one unit was recorded and is now effective (full physical profile).

    Message IDProductMeasured

    type = com.warehouse.wms.product-master.product.ProductMeasured, dataschema urn:warehouse:product-master:events:ProductMeasured:v1. Act on effective and version.

    allOf
    • #consumed
  • #8ZoneRegistered (consumed, facility-layout)

    A behavioural zone was added inside a site's area.

    Message IDZoneRegistered

    type = com.warehouse.wms.facility-layout.zone.ZoneRegistered, source /warehouse/facility-layout, dataschema urn:warehouse:facility-layout:events:ZoneRegistered:v1. Subject and Kafka key = zoneId. data also carries eventName, eventType and occurredAt, which are ignored.

    allOf
    • #consumed
  • #9LocationSlotRegistered (consumed, facility-layout)

    A coded leaf slot now exists on the warehouse map.

    Message IDLocationSlotRegistered

    type = com.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered, dataschema urn:warehouse:facility-layout:events:LocationSlotRegistered:v1. Subject and Kafka key = locationCode. An absent role means Storage. data also carries eventName, eventType and occurredAt, which are ignored.

    allOf
    • #consumed
  • #10LocationSlotDecommissioned (consumed, facility-layout)

    A coded slot was permanently retired.

    Message IDLocationSlotDecommissioned

    type = com.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissioned, dataschema urn:warehouse:facility-layout:events:LocationSlotDecommissioned:v1. Subject and Kafka key = locationCode. Irreversible: the slot is removed from the local copy.

    allOf
    • #consumed
  • #11StockRelocated (consumed, inventory-storage)

    A quantity of one SKU moved from one bin to another bin of the same site.

    Message IDStockRelocated

    type = com.warehouse.wms.inventory-storage.stock.StockRelocated, dataschema urn:warehouse:inventory-storage:events:StockRelocated:v1. Subject and Kafka key = relocation_id. Restated from inventory-storage's contract (its ADR 0039), never imported.

    allOf
    • #consumed
  • #12Slot plan generated (analytics twin)

    The analytics-stream twin of SlotPlanGenerated (ADR 0006).

    Message IDSlotPlanGeneratedAnalytics

    Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:slotting-optimization:analytics:SlotPlanGenerated:v1. Consumed only by cmd/slotting-projector.

    allOf
    • #analytics
  • #13Slot plan approved (analytics twin)

    The analytics-stream twin of SlotPlanApproved (ADR 0006).

    Message IDSlotPlanApprovedAnalytics

    Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:slotting-optimization:analytics:SlotPlanApproved:v1. The supersedes_plan_id, when present, stamps the SUPERSEDED plan's supersession day in the read model.

    allOf
    • #analytics
  • #14Slot plan rejected (analytics twin)

    The analytics-stream twin of SlotPlanRejected (ADR 0006).

    Message IDSlotPlanRejectedAnalytics

    Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:slotting-optimization:analytics:SlotPlanRejected:v1.

    allOf
    • #analytics
  • #15ProductPackLevelDeclared (consumed, product-master)

    A pack level of a SKU was declared or revised.

    Message IDProductPackLevelDeclared

    type = com.warehouse.wms.product-master.product.ProductPackLevelDeclared, source /warehouse/product-master, dataschema urn:warehouse:product-master:events:ProductPackLevelDeclared:v1. Subject and key = the SKU. Applied to the local PackLevelView (ADR 0012, PACK_LEVEL_MODE=kafka, group PACK_LEVEL_CONSUMER_GROUP) only when version is greater than the stored one. Payload pinned by product-master's apis/asyncapi.yaml on develop.

    object allOf

    CloudEvents 1.0 envelope of product-master's ProductPackLevelDeclared, as consumed here.

    • #consumed
  • #16ProductPackLevelRetired (consumed, product-master)

    A pack level of a SKU was retired.

    Message IDProductPackLevelRetired

    type = com.warehouse.wms.product-master.product.ProductPackLevelRetired, source /warehouse/product-master, dataschema urn:warehouse:product-master:events:ProductPackLevelRetired:v1. Subject and key = the SKU. Applied to the local PackLevelView (ADR 0012, PACK_LEVEL_MODE=kafka, group PACK_LEVEL_CONSUMER_GROUP) only when version is greater than the stored one. Payload pinned by product-master's apis/asyncapi.yaml on develop.

    object allOf

    CloudEvents 1.0 envelope of product-master's ProductPackLevelRetired, as consumed here.

    • #consumed
  • #17ProductPackLevelMeasured (consumed, product-master)

    A pack level of a SKU was physically measured.

    Message IDProductPackLevelMeasured

    type = com.warehouse.wms.product-master.product.ProductPackLevelMeasured, source /warehouse/product-master, dataschema urn:warehouse:product-master:events:ProductPackLevelMeasured:v1. Subject and key = the SKU. Applied to the local PackLevelView (ADR 0012, PACK_LEVEL_MODE=kafka, group PACK_LEVEL_CONSUMER_GROUP) only when version is greater than the stored one. Payload pinned by product-master's apis/asyncapi.yaml on develop.

    object allOf

    CloudEvents 1.0 envelope of product-master's ProductPackLevelMeasured, as consumed here.

    • #consumed

Schemas

  • object
  • object
  • object
  • allOf
  • allOf
  • allOf
  • allOf
  • string
  • allOf
  • object
  • allOf
  • allOf
  • allOf
  • allOf
  • allOf
  • object allOf

    CloudEvents 1.0 envelope of product-master's ProductPackLevelDeclared, as consumed here.

  • object allOf

    CloudEvents 1.0 envelope of product-master's ProductPackLevelRetired, as consumed here.

  • object allOf

    CloudEvents 1.0 envelope of product-master's ProductPackLevelMeasured, as consumed here.