Skip to main content

Domain Events

Built on develop, not deployed

Derived from model/model.yaml. The shopping-cart service is built on develop (IQVO/shopping-cart at 95bc5bc, 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[shopping-cart].publishes and .consumes, with the producer's entry for each consumed event. 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/shopping-cart
typecom.retailnetwork.storefront.shopping-cart.cart.<EventName> (tier storefront, entity cart from the publishes rows)
subjectthe aggregate root id (cartId)
timethe instant the fact happened, UTC
datacontenttypeapplication/json
dataschemaas built urn:retailnetwork:shopping-cart:analytics:<EventName>:v1 (all four events are analytics-only; service ADR 0004, encoder goldens)
Kafka topicretailnetwork.shopping-cart.analytics — every published event is analytics-only, so by conventions.integration_rules the .events topic carries nothing from this context
Kafka keycartId, so one cart'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. All four events name their consumers as "analytics only": they go to the .analytics topic and no storefront or network context subscribes to a cart fact (Context Map).

CartLineAdded​

ItemValue
Full typecom.retailnetwork.storefront.shopping-cart.cart.CartLineAdded
Topicretailnetwork.shopping-cart.analytics
Subject / keycartId
Dataschemaurn:retailnetwork:shopping-cart:analytics:CartLineAdded:v1
Producing command / use caseAddLine (adding an item already in the cart merges quantities; the event carries the merged line)
Consumersanalytics only
FieldTypeMeaning
cartIdstringThe cart the line was added to.
catalogItemIdstringThe item added.
quantityintegerThe line's quantity after the merge.
attimestampWhen the add happened.

CartDeliveryQuoted​

ItemValue
Full typecom.retailnetwork.storefront.shopping-cart.cart.CartDeliveryQuoted
Topicretailnetwork.shopping-cart.analytics
Subject / keycartId
Dataschemaurn:retailnetwork:shopping-cart:analytics:CartDeliveryQuoted:v1
Producing command / use caseQuoteDelivery (after the synchronous QuoteDeliveryOffers call to delivery-promise)
Consumersanalytics only
FieldTypeMeaning
cartIdstringThe cart quoted.
destinationPostalPrefixstringThe prefix the quote was computed for.
groupCountintegerHow many shipment groups the quote holds.
attimestampWhen the quote was taken.

CartAbandoned​

ItemValue
Full typecom.retailnetwork.storefront.shopping-cart.cart.CartAbandoned
Topicretailnetwork.shopping-cart.analytics
Subject / keycartId
Dataschemaurn:retailnetwork:shopping-cart:analytics:CartAbandoned:v1
Producing command / use caseAbandonInactive policy (an OPEN cart with no change for 30 days)
Consumersanalytics only
FieldTypeMeaning
cartIdstringThe cart abandoned.
lastChangedAttimestampThe cart's last change; the fact the 30-day rule fired on.

CartCheckedOut​

ItemValue
Full typecom.retailnetwork.storefront.shopping-cart.cart.CartCheckedOut
Topicretailnetwork.shopping-cart.analytics
Subject / keycartId
Dataschemaurn:retailnetwork:shopping-cart:analytics:CartCheckedOut:v1
Producing command / use caseCloseOnCheckoutCompleted policy on checkout's CheckoutCompleted
Consumersanalytics only
FieldTypeMeaning
cartIdstringThe cart closed.
checkoutSessionIdstringThe session whose completion closed it.
attimestampWhen the cart was closed.

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 (CHECKOUT_CONSUMER_GROUP, OFFER_AVAILABILITY_CONSUMER_GROUP, PRICING_CONSUMER_GROUP; the service refuses to start without them); the names the design suggests: shopping-cart.offer-availability, shopping-cart.pricing, shopping-cart.checkout.

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

EventFull typeFields usedWhat this context does
CatalogItemCreatedcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemCreatedcatalogItemIdMarks the item known in PurchasabilityView, so AddLine can pass ErrItemNotPurchasable.
CatalogItemDiscontinuedcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemDiscontinuedcatalogItemIdMarks the item discontinued in PurchasabilityView; later AddLine attempts fail ErrItemNotPurchasable. Existing lines stay (the model clears lines for no event).

From pricing (retailnetwork.pricing.events, Customer/Supplier)​

EventFull typeFields usedWhat this context does
ItemPriceChangedcom.retailnetwork.storefront.pricing.itemprice.ItemPriceChangedcatalogItemId, effectivePriceMinorRefreshes the effective price in PurchasabilityView and EstimateView; the estimate moves, the cart lines and quote do not.
ItemPriceWithdrawncom.retailnetwork.storefront.pricing.itemprice.ItemPriceWithdrawncatalogItemIdMarks the item unpriced in PurchasabilityView (not purchasable); EstimateView can no longer price that line.
DeliveryChargeScheduleChangedcom.retailnetwork.storefront.pricing.deliverychargeschedule.DeliveryChargeScheduleChangedversion, tiersStores the new current tier charges in EstimateView (with the free-over thresholds).
TaxTableChangedcom.retailnetwork.storefront.pricing.taxtable.TaxTableChangedversion, bandsStores the new current bands in EstimateView; the destination prefix selects the band.

From checkout (retailnetwork.checkout.events, Customer/Supplier)​

EventFull typeFields usedWhat this context does
CheckoutCompletedcom.retailnetwork.storefront.checkout.checkoutsession.CheckoutCompletedcartId, sessionIdRuns CloseOnCheckoutCompleted: OPEN → CHECKED_OUT, publishing CartCheckedOut (analytics).

Ordering. Pricing keys item events by catalogItemId, so per-item price order holds; the schedule and table events are versioned, and the cart stores the version it applied. CheckoutCompleted is keyed by sessionId upstream — not by cartId — so the cart must not assume per-cart ordering from the partition: the inbox on the CloudEvents id makes a redelivery safe, and the only ordering that matters (quote before selection before checkout) is enforced inside the cart, not by the topic. A CheckoutCompleted for a cart that is not OPEN has no transition in the model: in practice the session outlives at most minutes while abandonment needs 30 idle days, and ErrCartClosed guards the terminal states (see the Aggregate Design Canvas).

None of the pricing or catalogue events touches the Cart aggregate itself: the quote and selections are cleared by line or destination changes only (business decision 3) — a price move never clears a quote; it moves the labelled estimate and the purchasability verdict.

Example envelope​

CartDeliveryQuoted, the event every funnel measures (all ids synthetic):

{
"specversion": "1.0",
"id": "3e9a71c4-8b2d-4f57-9c1e-6a0b2d8e4f77",
"source": "/retailnetwork/shopping-cart",
"type": "com.retailnetwork.storefront.shopping-cart.cart.CartDeliveryQuoted",
"subject": "cart-4f8b1c",
"time": "2026-10-24T09:12:41Z",
"datacontenttype": "application/json",
"dataschema": "urn:retailnetwork:shopping-cart:analytics:CartDeliveryQuoted:v1",
"data": {
"cartId": "cart-4f8b1c",
"destinationPostalPrefix": "01310",
"groupCount": 2,
"at": "2026-10-24T09:12:41Z"
}
}

No shopper reference appears in any cart event: the events carry the cart id and item ids only, and the optional shopperId never leaves the aggregate (conventions.no_auth — the storefront stores no PII).