Skip to main content

Domain events

Every event this context publishes. All are CloudEvents 1.0 in structured content mode (internal/adapters/kafka/cloudevents: the whole event is the JSON message value, Kafka header content-type: application/cloudevents+json; charset=UTF-8). Payload fields come from apis/asyncapi.yaml and the payload structs in internal/adapters/outbound/kafka/encoder.go; the event catalogue summarises the AsyncAPI file and ADR 0004 is the type catalogue (checked against the AsyncAPI file by TestEventCatalogueMatchesContract).

Published​

Raised by the Product aggregate (internal/domain/product/events.go), encoded by internal/adapters/outbound/kafka/encoder.go and inserted into outbox_events inside the use case's unit of work; the relay in cmd/api publishes them. Common attributes: source=/warehouse/product-master, subject = Kafka key = partition key = the SKU (kafkago.Hash balancer), time = domain occurred-at (UTC), dataschema=urn:warehouse:product-master:events:<EventName>:v1.

Full CloudEvents typeTopicProducer use casePayload (data)Known consumers
com.warehouse.wms.product-master.product.ProductRegisteredwarehouse.product-master.eventsRegisterProduct (new SKU)sku, description, version (1)inbound-receiving (known_skus copy, PRODUCT_CONSUMER_GROUP)
com.warehouse.wms.product-master.product.ProductDescriptionChangedwarehouse.product-master.eventsRegisterProduct (existing SKU, different description)sku, description, versionnone
com.warehouse.wms.product-master.product.ProductClassifiedwarehouse.product-master.eventsClassifyProductsku, handling_tags[], temperature_class (omitted when unset), dot_hazard_class (omitted when unset), classification_source, versioninventory-storage (PRODUCT_MASTER_CONSUMER_GROUP), order-management, wes-work-planning, fulfillment-execution, returns-processing (each PRODUCT_CLASSIFICATION_CONSUMER_GROUP), slotting-optimization (PRODUCT_CONSUMER_GROUP)
com.warehouse.wms.product-master.product.ProductDimensionsDeclaredwarehouse.product-master.eventsDeclareDimensionsfull physical profile: sku, declared, measured, effective (each omitted when absent), effective_source, discrepancy, versionslotting-optimization (PRODUCT_CONSUMER_GROUP); the other uses ADR 0002 names are not built
com.warehouse.wms.product-master.product.ProductMeasuredwarehouse.product-master.eventsRecordMeasurementthe same full physical profileslotting-optimization (PRODUCT_CONSUMER_GROUP)
com.warehouse.wms.product-master.product.ProductPackLevelDeclaredwarehouse.product-master.eventsDeclarePackLevelthe full level: sku, level, gtin, child_gtin?, qty_of_child?, units_per_pack, dims?, is_orderable, is_despatch_unit, effective_from, versioninbound-receiving (PACKAGING_CONSUMER_GROUP), inventory-storage (PRODUCT_MASTER_CONSUMER_GROUP), slotting-optimization and pick-face-replenishment (each PACK_LEVEL_CONSUMER_GROUP), fulfillment-execution and wes-work-planning (each PACK_VIEW_CONSUMER_GROUP), network-inventory-planning (PACK_LEVEL_CONSUMER_GROUP); each builds its own projection. ADR 0011 also names process-path-management, labor-performance and network-fulfillment: none of them consumes the type on develop
com.warehouse.wms.product-master.product.ProductPackLevelRetiredwarehouse.product-master.eventsRetirePackLevel, DeclarePackLevel (a new GTIN at an active level, reason superseded)sku, level, gtin, effective_to, reason, versionthe same seven
com.warehouse.wms.product-master.product.ProductPackLevelMeasuredwarehouse.product-master.eventsRecordPackLevelMeasurementsku, level, gtin, dims, measured_at, device_id?, versionslotting-optimization (PACK_LEVEL_CONSUMER_GROUP) and wes-work-planning (PACK_VIEW_CONSUMER_GROUP); the other five pack level consumers ignore it by type

The pack level events use the snake_case of the others; every gtin is the 14-digit zero-left-padded string, level is EACH | INNER | CASE | PALLET, dims is {length_mm, width_mm, height_mm, weight_g} and units_per_pack is the direct factor to eaches. A new GTIN at an active level raises Retired (superseded) and then Declared, one version apart. A consumer must keep retired levels: an in-flight ASN may still name the old GTIN.

declared and effective are {length_mm, width_mm, height_mm, weight_g, volume_mm3} (integers); measured adds measured_at (RFC 3339, UTC) and device_id (omitted when empty). handling_tags is in the stable order Hazmat, Fragile, TemperatureSensitive, Oversized, HighValue. The first four ProductClassified field names were kept identical to inventory-storage's former v1 payload, on purpose, so consumers that migrated from it kept their field mapping (ADR 0004); that type was retired at stage E and nothing publishes it any more. classification_source is native for every classification written since stage E; legacy-import appears only for a SKU whose stored classification the ADR 0003 importer wrote and nobody has re-classified since.

Ordering and replay. Events of one SKU share a partition, so they arrive in order; the outbox relay stops a pass at the first failure so a later event never overtakes an earlier one that is still being retried (a row excluded by the relay attempt cap, ADR 0007, is overtaken). Every payload carries the version after the change: a consumer applies a message only when its version is greater than the stored one, which makes redelivery and replay harmless. A change that alters nothing raises no event.

Analytics copy​

Every unit event above (not the three pack level events) is ALSO written, in the same outbox transaction and under the same CloudEvents id, to warehouse.product-master.analytics (dataschema urn:warehouse:product-master:analytics:<EventName>:v1, same payload), consumed only by this service's product-projector for the master data quality report (ADR 0006).

Not published​

No "unclassify" event exists.

Consumed​

None from another context. The ADR 0003 legacy importer, which consumed com.warehouse.wms.inventory-storage.product.ProductClassified from warehouse.inventory.events, was removed at stage E (2026-10-17) together with LEGACY_IMPORT_CONSUMER_GROUP, and inventory-storage no longer publishes that type. The only consumer in this repository is cmd/product-projector, which reads this context's own warehouse.product-master.analytics topic (see Runtime).

Source: internal/domain/product/events.go, internal/adapters/outbound/kafka/encoder.go, internal/adapters/inbound/kafka/kafka.go, cmd/api/main.go, apis/asyncapi.yaml; the consumers' code on their develop branches (see Downstream consumers).