Skip to main content

Event catalogue

Every Kafka message this service produces or consumes is a CloudEvents 1.0 event in structured mode: the Kafka value is the whole JSON envelope and the header content-type is application/cloudevents+json; charset=UTF-8. Envelopes are built and decoded only in internal/adapters/kafka/cloudevents (ADR 0004). The contract is apis/asyncapi.yaml (AsyncAPI 3.0.0, version 1.0.0), kept equal to the code by TestEventCatalogueMatchesContract; field-level detail and Mermaid diagrams are on Domain events.

Source: internal/adapters/outbound/kafka/{encoder,encoder_data,payloads}.go, internal/adapters/inbound/kafka/offer_availability.go, golden files in internal/adapters/outbound/kafka/testdata/.

Envelope​

AttributeValue
specversion1.0
idUUID minted once at encode time and stored with the outbox row; stable across relay retries. Dedupe on it
source/retailnetwork/pricing
typecom.retailnetwork.storefront.pricing.<entity>.<EventName>
subjectthe aggregate id; also the Kafka key
timethe instant of the change, RFC 3339 UTC
datacontenttypeapplication/json
dataschemaurn:retailnetwork:pricing:<events or analytics>:<EventName>:v1; the stream segment names the topic stream (ADR 0006)

data is camelCase, amounts are integer minor units of the single configured currency, optional fields are omitted when absent (never null), arrays are always present. A breaking payload change is a new .v2 type. Consumers dispatch on the full type, ignore unknown types and dedupe on id. Kafka messages also carry W3C traceparent headers when the raising request was traced.

Published​

TypeTopicKeyRaised whendata
com.retailnetwork.storefront.pricing.itemprice.ItemPriceChangedretailnetwork.pricing.eventscatalogItemIdan item is first priced, and whenever the list price, the effective price or the sale end differs from the last published view: SetListPrice, a sale window opening or closing (PublishEffectivePriceOnWindowBoundary), ScheduleSale of an open window, CancelSale of the live salecatalogItemId, currency, listPriceMinor, effectivePriceMinor, saleEndsAt? (only while a sale is live), version
com.retailnetwork.storefront.pricing.itemprice.ItemPriceWithdrawnretailnetwork.pricing.eventscatalogItemIdWithdrawPrice or the WithdrawOnDiscontinue policycatalogItemId, version
com.retailnetwork.storefront.pricing.deliverychargeschedule.DeliveryChargeScheduleChangedretailnetwork.pricing.eventsscheduleIdPublishChargeSchedule; the previous schedule is SUPERSEDED in the same transactionscheduleId, version, tiers[{tier, chargeMinor, freeOverMinor?}]
com.retailnetwork.storefront.pricing.taxtable.TaxTableChangedretailnetwork.pricing.eventstaxTableIdPublishTaxTable; the previous table is SUPERSEDED in the same transactiontaxTableId, version, bands[{postalPrefixFrom, postalPrefixTo, rateBasisPoints}]
com.retailnetwork.storefront.pricing.pricequote.PriceQuoteIssuedretailnetwork.pricing.analytics (analytics only)quoteIdIssuePriceQuotequoteId, cartId, currency, totalMinor, expiresAt

Ordering: item events of one item share the key and carry a monotonically increasing version; a consumer applies a version only above the last one it applied. Schedule and tax-table events carry the published version. There is no PriceQuoteExpired event and CancelSale has no event of its own.

Consumed​

TypeTopicUsed for
com.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemCreatedretailnetwork.offer-availability.eventsmarks the item ACTIVE in the local catalogue view
com.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemDiscontinuedretailnetwork.offer-availability.eventsmarks the item DISCONTINUED and withdraws its ACTIVE price

Only data.catalogItemId is read; unknown fields are ignored and every other type on the topic is skipped. The consumer group comes from OFFER_AVAILABILITY_CONSUMER_GROUP. A message that fails is retried and then published to retailnetwork.offer-availability.events.dlq with x-dlq-* headers; see the Runbook.

Dataschema per stream​

apis/asyncapi.yaml declares the PriceQuoteIssued dataschema as urn:retailnetwork:pricing:analytics:PriceQuoteIssued:v1 and the other four as ...:events:..., and the encoder produces exactly that: the stream of each event (internal/adapters/outbound/kafka/encoder.go, buildMessage) decides the segment, so it always names the topic the event is on.