Skip to main content

Event catalogue

product-discovery consumes eleven event types from three topics and publishes none: there is no outbox, no relay, no retailnetwork.product-discovery.events topic and no analytics topic. Its only Kafka producer is the dead-letter writer. Every message is a CloudEvents 1.0 event in structured mode: the Kafka value is the whole JSON envelope. Envelopes are decoded only in internal/adapters/kafka/cloudevents (ADR 0004); a message that is not a valid CloudEvents 1.0 event is logged at WARN and skipped. The contract is apis/asyncapi.yaml (it records only the fields this service reads; each producer's own AsyncAPI is authoritative and unknown fields are ignored). TestEventCatalogueMatchesContract keeps the code's type list and the spec in step. Field-level notes are on Domain events.

Source: internal/adapters/inbound/kafka/{offer_availability,product_content,pricing,handlers}.go.

Published​

None. The dead-letter record is the only thing the service writes to Kafka: it copies the failed message to <topic>.dlq with the original key, value and headers plus x-dlq-source-topic, x-dlq-source-partition, x-dlq-source-offset, x-dlq-error and x-dlq-failed-at (Runbook).

Consumed​

Dispatch is on the full type string; any other type on these topics is skipped, committed and counted in discovery.kafka.poison_messages (reason=unknown-type). The CloudEvents id is the idempotency key (processed_events). The Kafka key is the item id for item, content and price events and the listing id for listing events (apis/asyncapi.yaml); the examples carry the same value as the CloudEvents subject.

offer-availability: retailnetwork.offer-availability.events (group OFFER_AVAILABILITY_CONSUMER_GROUP)​

Type prefix com.retailnetwork.commerce.offer-availability.

Type suffixdata fields readGuardEffect
catalogitem.CatalogItemCreatedcatalogItemId, title, hazmat, fragilethe title of a known row is immutablecreates or completes the row; item ACTIVE
catalogitem.CatalogItemDiscontinuedcatalogItemIdnoneitem DISCONTINUED; never purchasable again
listing.ListingCreatedlistingId, catalogItemId, nodeIdnonelearns the listing; adds a LIVE listing
listing.ListingAvailabilityChangedlistingId, catalogItemId, nodeId, availableQty, asOfasOf strictly newer than the listing'ssets the quantity; recomputes inStock
listing.ListingSuppressedlistingIdnonelisting SUPPRESSED; never counts towards inStock
listing.ListingRestoredlistingIdnonelisting LIVE again

product-content: retailnetwork.product-content.events (group PRODUCT_CONTENT_CONSUMER_GROUP)​

Type prefix com.retailnetwork.storefront.product-content.

Type suffixdata fields readGuardEffect
productcontent.ProductContentPublishedcatalogItemId, revision, description, bullets[], attributes[{name, value, unit}], media[{mediaId, url, altText, role}], primaryCategoryIdrevision strictly higher than the folded onereplaces the content and the category id; content PUBLISHED; re-indexes the search document
productcontent.ProductContentRetiredcatalogItemId, revision (optional)an older revision than the folded one is stale; absent means 0 and always appliescontent RETIRED; purchasable and searchable become false
categorytree.CategoryTreePublishedversion, categories[{categoryId, parentId, name, path}]version strictly higher than the current treereplaces the whole tree; counts are re-derived

pricing: retailnetwork.pricing.events (group PRICING_CONSUMER_GROUP)​

Type prefix com.retailnetwork.storefront.pricing.itemprice.

Type suffixdata fields readGuardEffect
ItemPriceChangedcatalogItemId, currency, listPriceMinor, effectivePriceMinor, versionversion strictly highersets both prices; price ACTIVE (revives a withdrawn price)
ItemPriceWithdrawncatalogItemId, versionnot older than the folded versionprice WITHDRAWN, amounts cleared

What makes a fact unusable​

A fact that can never be folded is dead-lettered at once (no retry): data that does not decode; an id that is not 1 to 64 characters of A-Z a-z 0-9 . _ : - starting with a letter or digit; a title that is empty or over 500 characters; a negative availableQty, listPriceMinor or effectivePriceMinor; a zero asOf; a currency that is not three capital letters; a version or revision below 1 (a retire may carry 0); an invalid category tree (duplicate id, empty name, unknown parent, a parent cycle). Everything else the guards decide is silent: a stale fact is acknowledged without effect.

Example envelope​

{
"specversion": "1.0",
"id": "5b0f8a52-3c1e-4d7a-9f4e-2a6d1c9e7b31",
"source": "/retailnetwork/offer-availability",
"type": "com.retailnetwork.commerce.offer-availability.listing.ListingAvailabilityChanged",
"subject": "LST-000184",
"time": "2026-10-22T14:05:12Z",
"datacontenttype": "application/json",
"dataschema": "urn:retailnetwork:offer-availability:events:ListingAvailabilityChanged:v1",
"data": {
"listingId": "LST-000184",
"catalogItemId": "CI-004512",
"nodeId": "NODE-VWS-FC01",
"availableQty": 120,
"asOf": "2026-10-22T14:00:00Z"
}
}

Source: apis/asyncapi.yaml (the example of the message), the same envelope the Quickstart publishes.

Consumer groups and dead-letter topics​

TopicConsumer group variableDead-letter topic
retailnetwork.offer-availability.eventsOFFER_AVAILABILITY_CONSUMER_GROUPretailnetwork.offer-availability.events.dlq
retailnetwork.product-content.eventsPRODUCT_CONTENT_CONSUMER_GROUPretailnetwork.product-content.events.dlq
retailnetwork.pricing.eventsPRICING_CONSUMER_GROUPretailnetwork.pricing.events.dlq

The group ids are mandatory, stable and have no default; the chart and warehouse-infra choose product-discovery-offer-availability, product-discovery-product-content and product-discovery-pricing.