Skip to main content

Domain Events

Built on develop, not deployed

Derived from model/model.yaml. The product-content service is built on develop (IQVO/product-content at 2f09dc0, checked 2026-10-27) and not deployed (no warehouse-infra entry). Every Err... name, REST route and CloudEvents type of this context named on this page exists in the service; where the built service differs from the model's design, the page says so (As built) or the context's Service and operations section lists it.

Every event this context publishes and consumes, from contexts[product-content].publishes and .consumes, with the producer's entry for each consumed event. The storefront-wide rules are on Event standard: CloudEvents.

Envelope​

Every Kafka message is a CloudEvents 1.0 event in structured JSON mode (conventions.cloudevents):

AttributeValue for this context
specversion1.0
ida UUID minted once when the event is written to the outbox; a redelivery carries the same id
source/retailnetwork/product-content
typecom.retailnetwork.storefront.product-content.<entity>.<EventName> (tier storefront, entity productcontent or categorytree)
subjectthe aggregate root id: the catalogItemId for content events, the categoryTreeId for tree events
timethe instant the fact happened, UTC
datacontenttypeapplication/json
dataschemaurn:retailnetwork:product-content:events:<EventName>:v1
Kafka topicretailnetwork.product-content.events
Kafka keythe subject, so one item's content events stay on one partition and in order

Published​

Every event is written to outbox_events in the same transaction as the aggregate save, and a relay publishes it. No published event carries a title, a price, stock or PII: only content, category data and references. The model lists no analytics-only event for this context, so the retailnetwork.product-content.analytics topic receives nothing.

ProductContentPublished​

ItemValue
Full typecom.retailnetwork.storefront.product-content.productcontent.ProductContentPublished
Topicretailnetwork.product-content.events
Subject / keycatalogItemId
Dataschemaurn:retailnetwork:product-content:events:ProductContentPublished:v1
Producing command / use casePublishContent (REST POST /product-contents/{catalogItemId}/publications)
Consumersproduct-discovery (folds the content into ProductView, guarded by revision)
FieldTypeMeaning
catalogItemIdstringThe catalogue item this content belongs to.
revisionintegerThe published shape's number; product-discovery applies it only above the last applied revision (its per-source monotonic guard).
descriptionstringThe product-page prose.
bulletsstring[]The bullet list under the title; at most 10.
attributesarrayThe attribute table: name, value, optional unit; at most 50.
mediaarrayThe pictures: mediaId, url, altText, role PRIMARY or GALLERY; at most 12, exactly one PRIMARY.
primaryCategoryIdstringThe item's place in the published category tree.

Why the full content. product-discovery renders the product page from its own ProductView and never calls this context on a shopper request, so the event carries everything the page needs. The revision lets the consumer drop an out-of-order redelivery.

ProductContentRetired​

ItemValue
Full typecom.retailnetwork.storefront.product-content.productcontent.ProductContentRetired
Topicretailnetwork.product-content.events
Subject / keycatalogItemId
Dataschemaurn:retailnetwork:product-content:events:ProductContentRetired:v1
Producing command / use caseRetireContent: from the content manager (REST POST /product-contents/{catalogItemId}/retirements) or from the RetireOnDiscontinue policy
Consumersproduct-discovery (the item's content is no longer PUBLISHED, so the item stops being purchasable)
FieldTypeMeaning
catalogItemIdstringThe catalogue item whose content is retired.
revisionintegerThe revision that was retired; the consumer's monotonic guard still applies.

CategoryTreePublished​

ItemValue
Full typecom.retailnetwork.storefront.product-content.categorytree.CategoryTreePublished
Topicretailnetwork.product-content.events
Subject / keycategoryTreeId
Dataschemaurn:retailnetwork:product-content:events:CategoryTreePublished:v1
Producing command / use casePublishCategoryTree (no inbound row and no REST route name its trigger; see the canvas open questions)
Consumersproduct-discovery (rebuilds CategoryView for the version, guarded by version)
FieldTypeMeaning
versionintegerThe tree version; product-discovery applies it only above the last applied version.
categoriesarrayThe whole tree: one entry per category with categoryId, parentId, name and path.

Why the whole tree. The model declares the payload as categories(categoryId, parentId, name, path) under one version, so the consumer replaces its tree in one step instead of replaying edits. At roughly 10^3 categories (size_estimate) the message stays small.

Consumed​

The consumer is idempotent on the CloudEvents id: the id is inserted into processed_events in the same transaction as the effect, and a duplicate is acknowledged without effect. It dispatches on the full type string, never on a suffix. Consumer group names come from mandatory environment variables (OFFER_AVAILABILITY_CONSUMER_GROUP; the service refuses to start without them); the names the design suggests: product-content.offer-availability.

From offer-availability (retailnetwork.offer-availability.events, Conformist)​

EventFull typeFields usedWhat this context does
CatalogItemCreatedcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemCreatedcatalogItemIdProjects the item into CatalogItemView, so CreateProductContent can pass ErrUnknownCatalogItem. The event's other fields (title, dimensions, GTIN, flags) are dropped: the item master owns them.
CatalogItemDiscontinuedcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemDiscontinuedcatalogItemIdMarks the item discontinued in CatalogItemView, then the RetireOnDiscontinue policy retires the item's content with reason DISCONTINUED: PUBLISHED content is retired and ProductContentRetired is published; a DRAFT is retired silently (no event, because nothing was published); content that is already RETIRED is left alone.

Ordering. The producer keys by catalogItemId, so the two events of one item arrive in order. Content events of one item are keyed the same way here, so product-discovery sees ProductContentPublished and ProductContentRetired of one item in order; the revision guard covers anything Kafka cannot. An event for an item whose CatalogItemCreated has not been consumed yet is impossible to reject by invariant — the view is simply behind; consumption order on one key prevents it for the same item.

Example envelope​

The most important event, ProductContentPublished, for revision 2 of an item (all ids synthetic, all values illustrative):

{
"specversion": "1.0",
"id": "7d2e9c41-5f6b-4a3e-9c2d-1e8f0a5b6c7d",
"source": "/retailnetwork/product-content",
"type": "com.retailnetwork.storefront.product-content.productcontent.ProductContentPublished",
"subject": "cat-100234",
"time": "2026-10-22T14:03:11Z",
"datacontenttype": "application/json",
"dataschema": "urn:retailnetwork:product-content:events:ProductContentPublished:v1",
"data": {
"catalogItemId": "cat-100234",
"revision": 2,
"description": "A 2-litre insulated steel bottle that keeps drinks cold for a day.",
"bullets": [
"Double-wall vacuum insulation",
"Fits a standard bottle cage",
"Dishwasher-safe cap"
],
"attributes": [
{"name": "capacity", "value": "2", "unit": "l"},
{"name": "material", "value": "stainless steel"}
],
"media": [
{"mediaId": "med-01", "url": "https://static.example.invalid/cat-100234/main.jpg", "altText": "Steel bottle, side view", "role": "PRIMARY"},
{"mediaId": "med-02", "url": "https://static.example.invalid/cat-100234/cap.jpg", "altText": "Cap detail", "role": "GALLERY"}
],
"primaryCategoryId": "cat-bottles"
}
}

There is no title (the item master's), no price (pricing), no stock (offer-availability) and no PII anywhere in the envelope.