Skip to main content

Domain Events

Every event this context publishes and consumes, with the producer's entry for each consumed event. Source: apis/asyncapi.yaml, internal/adapters/outbound/kafka/{encoder,encoder_data,payloads}.go, internal/adapters/inbound/kafka/offer_availability.go. The domain-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/pricing
typecom.retailnetwork.storefront.pricing.<entity>.<EventName> (tier storefront, entity from the publishes row)
subjectthe aggregate root id (catalogItemId, scheduleId, taxTableId, quoteId)
timethe instant the fact happened, UTC
datacontenttypeapplication/json
dataschemaurn:retailnetwork:pricing:<events or analytics>:<EventName>:v1; the stream segment names the stream the event is on
Kafka topicretailnetwork.pricing.events (retailnetwork.pricing.analytics for analytics-only events)
Kafka keythe aggregate root id, so one item's, schedule's or quote's 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. PriceQuoteIssued is analytics-only: by conventions.integration_rules it goes to the .analytics topic only.

ItemPriceChanged​

ItemValue
Full typecom.retailnetwork.storefront.pricing.itemprice.ItemPriceChanged
Topicretailnetwork.pricing.events
Subject / keycatalogItemId
Dataschemaurn:retailnetwork:pricing:events:ItemPriceChanged:v1
Producing command / use caseCreateItemPrice, SetListPrice, ScheduleSale (window already open), CancelSale (live sale), and the PublishEffectivePriceOnWindowBoundary policy at a sale boundary
Consumersproduct-discovery (price fields and purchasable on ProductView, guarded by the price version), shopping-cart (PurchasabilityView, EstimateView)
FieldTypeMeaning
catalogItemIdstringThe catalogue item priced.
currencystringThe one configured currency (ISO 4217).
listPriceMinorintegerThe standing list price in minor units.
effectivePriceMinorintegerThe lowest active sale price, else the list price.
saleEndsAttimestamp, optionalWhen the active sale window ends; absent at list price.
versionintegerThe item price's version; consumers apply it as a monotonic guard.

ItemPriceWithdrawn​

ItemValue
Full typecom.retailnetwork.storefront.pricing.itemprice.ItemPriceWithdrawn
Topicretailnetwork.pricing.events
Subject / keycatalogItemId
Dataschemaurn:retailnetwork:pricing:events:ItemPriceWithdrawn:v1
Producing command / use caseWithdrawPrice, including the WithdrawOnDiscontinue policy on CatalogItemDiscontinued
Consumersproduct-discovery (item no longer purchasable), shopping-cart (PurchasabilityView)
FieldTypeMeaning
catalogItemIdstringThe item whose price is withdrawn.
versionintegerThe item price's version at withdrawal.

DeliveryChargeScheduleChanged​

ItemValue
Full typecom.retailnetwork.storefront.pricing.deliverychargeschedule.DeliveryChargeScheduleChanged
Topicretailnetwork.pricing.events
Subject / keyscheduleId
Dataschemaurn:retailnetwork:pricing:events:DeliveryChargeScheduleChanged:v1
Producing command / use casePublishChargeSchedule
Consumersshopping-cart (EstimateView tier charges)
FieldTypeMeaning
scheduleIdstringThe new current schedule.
versionintegerStrictly increasing schedule version.
tiers[]arrayOne entry per service tier.
tiers[].tierenumSAME_DAY, NEXT_DAY, TWO_DAY, STANDARD or CONSOLIDATED (a row only when the schedule declares it; absent means free).
tiers[].chargeMinorintegerThe delivery charge for the tier, minor units.
tiers[].freeOverMinorinteger, optionalFree-delivery threshold for the tier, minor units.

TaxTableChanged​

ItemValue
Full typecom.retailnetwork.storefront.pricing.taxtable.TaxTableChanged
Topicretailnetwork.pricing.events
Subject / keytaxTableId
Dataschemaurn:retailnetwork:pricing:events:TaxTableChanged:v1
Producing command / use casePublishTaxTable
Consumersshopping-cart (EstimateView tax band)
FieldTypeMeaning
taxTableIdstringThe new current tax table.
versionintegerStrictly increasing table version.
bands[]arrayThe postal-prefix bands.
bands[].postalPrefixFromstringBand start, inclusive.
bands[].postalPrefixTostringBand end, inclusive.
bands[].rateBasisPointsintegerSynthetic rate in basis points (D10).

PriceQuoteIssued​

ItemValue
Full typecom.retailnetwork.storefront.pricing.pricequote.PriceQuoteIssued
Topicretailnetwork.pricing.analytics (analytics only)
Subject / keyquoteId
Dataschemaurn:retailnetwork:pricing:analytics:PriceQuoteIssued:v1 (ADR 0006)
Producing command / use caseIssuePriceQuote (REST POST /price-quotes, called by checkout)
Consumersanalytics only
FieldTypeMeaning
quoteIdstringThe quote.
cartIdstringThe cart the quote prices.
currencystringThe configured currency.
totalMinorintegerThe binding total.
expiresAttimestampissuedAt plus the QuoteTtl (default 15 minutes).

checkout does not consume PriceQuoteIssued: it gets the quote in the synchronous reply to POST /price-quotes. No PriceQuoteExpired event exists.

Consumed​

Every 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. Consumers dispatch 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 group deployed by warehouse-infra is pricing-offer-availability.

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

EventFull typeFields usedWhat this context does
CatalogItemCreatedcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemCreatedcatalogItemIdAdds the item to CatalogItemView as known and not discontinued, so CreateItemPrice, SetListPrice and ScheduleSale can pass ErrUnknownCatalogItem.
CatalogItemDiscontinuedcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemDiscontinuedcatalogItemIdMarks the item discontinued in CatalogItemView and runs WithdrawOnDiscontinue: WithdrawPrice, publishing ItemPriceWithdrawn.

Ordering. The producer keys by catalogItemId, and pricing's view and aggregate share that key, so create-before-discontinue holds per item. A CatalogItemDiscontinued for an item pricing has never priced only updates the view; no ItemPriceWithdrawn is emitted for a price that does not exist.

Example envelope​

The most-consumed event, ItemPriceChanged, for an item entering a sale (all ids synthetic):

{
"specversion": "1.0",
"id": "7a2c9e41-5f0b-4c3d-9e6a-1b8d4f0c2a55",
"source": "/retailnetwork/pricing",
"type": "com.retailnetwork.storefront.pricing.itemprice.ItemPriceChanged",
"subject": "cat-100234",
"time": "2026-10-24T09:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:retailnetwork:pricing:events:ItemPriceChanged:v1",
"data": {
"catalogItemId": "cat-100234",
"currency": "BRL",
"listPriceMinor": 12990,
"effectivePriceMinor": 9990,
"saleEndsAt": "2026-10-31T23:59:59Z",
"version": 7
}
}

No shopper reference appears in any pricing event: the storefront stores no PII, and a quote names its cartId, never a person (conventions.no_auth).