Skip to main content

Domain Events

As built

Derived from network/model/model.yaml. This context's service is built; the model carries its as-built contracts, and identifiers (Err... names, routes, CloudEvents types) are the names the service uses.

Every event this context publishes and consumes, from contexts[offer-availability].publishes and .consumes, with the envelope rules of conventions.cloudevents. The event standard is CloudEvents; the namespace decision is ADR 0007.

Envelope​

AttributeValue
specversion1.0 (structured JSON, mandatory on every Kafka message)
ida UUID minted once, when the event is written to outbox_events; a redelivery carries the same id
source/retailnetwork/offer-availability
typecom.retailnetwork.commerce.offer-availability.<entity>.<EventName>; <entity> is catalogitem, listing or inventoryfeed
subjectthe aggregate root id: catalogItemId, listingId or feedId
timethe instant the aggregate change committed, UTC
datacontenttypeapplication/json
dataschemaurn:retailnetwork:offer-availability:events:<EventName>:v1
Topicretailnetwork.offer-availability.events
Kafka keythe same aggregate root id as subject, so one aggregate's events share a partition

Every event leaves through a transactional outbox written in the same transaction as the aggregate change (conventions.integration_rules).

Published​

EventFull typeSubject / keyProducing command (use case)Consumers
CatalogItemCreatedcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemCreatedcatalogItemIdCreateCatalogItemdelivery-promise, shipping-and-tracking, seller-inbound
CatalogItemDiscontinuedcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemDiscontinuedcatalogItemIdDiscontinueItemdelivery-promise, order-sourcing, seller-inbound
CatalogItemPackagingDeclaredcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemPackagingDeclaredcatalogItemIdDeclarePackagingseller-inbound, vendor-connectivity
CatalogItemPackLevelRetiredcom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemPackLevelRetiredcatalogItemIdRetirePackLevelseller-inbound, vendor-connectivity
ListingCreatedcom.retailnetwork.commerce.offer-availability.listing.ListingCreatedlistingIdCreateListingdelivery-promise, order-sourcing, vendor-connectivity
ListingAvailabilityChangedcom.retailnetwork.commerce.offer-availability.listing.ListingAvailabilityChangedlistingIdApplyAvailability (inside ApplyInventoryFeed, including FullFeedZeroing)delivery-promise, order-sourcing
ListingSuppressedcom.retailnetwork.commerce.offer-availability.listing.ListingSuppressedlistingIdSuppressListing (policy SuppressOnNodeUnavailable)delivery-promise, order-sourcing
ListingRestoredcom.retailnetwork.commerce.offer-availability.listing.ListingRestoredlistingIdRestoreListing (policy SuppressOnNodeUnavailable)delivery-promise, order-sourcing
InventoryFeedAppliedcom.retailnetwork.commerce.offer-availability.inventoryfeed.InventoryFeedAppliedfeedIdApplyInventoryFeed (feed reaches APPLIED)node-performance

Data fields​

The field lists are the model's data arrays. Types are the proposed JSON types.

CatalogItemCreated

FieldTypeMeaning
catalogItemIdstringThe item's id (also subject).
titlestringDisplay title.
lengthMmintegerLength in millimetres, > 0.
widthMmintegerWidth in millimetres, > 0.
heightMmintegerHeight in millimetres, > 0.
weightGintegerWeight in grams, > 0.
hazmatbooleanHazardous-material handling flag.
fragilebooleanFragile handling flag.
gtinstring, optionalProposed (ADR 0009): the each-level GTIN, 14 digits. Additive.

CatalogItemDiscontinued

FieldTypeMeaning
catalogItemIdstringThe discontinued item.

ListingCreated

FieldTypeMeaning
listingIdstringThe listing's id (also subject).
catalogItemIdstringThe item offered.
nodeIdstringThe node it is offered from.

ListingAvailabilityChanged

FieldTypeMeaning
listingIdstringThe listing (also subject).
catalogItemIdstringThe item, so consumers need no join.
nodeIdstringThe node, so consumers need no join.
availableQtyintegerThe node's claimed quantity, >= 0.
basisstringPHYSICAL, THROUGHPUT_CONSTRAINED or UNKNOWN, as the vendor declared it.
asOfstring (date-time)The instant the number is true for; strictly increasing per listing.
feedIdstringThe feed that carried the number.

ListingSuppressed

FieldTypeMeaning
listingIdstringThe listing (also subject).
nodeIdstringIts node.
reasonstringWhy it was suppressed. The model gives no vocabulary; the only modelled trigger is SuppressOnNodeUnavailable (node suspended or retired).

ListingRestored

FieldTypeMeaning
listingIdstringThe listing (also subject).
nodeIdstringIts node.

InventoryFeedApplied

FieldTypeMeaning
feedIdstringThe feed (also subject).
nodeIdstringThe node the feed is for.
fullUpdatebooleanTrue for a full feed.
lineCountintegerLines in the feed as received.
appliedAtstring (date-time)When the feed reached APPLIED.

Example envelope​

ListingAvailabilityChanged is the event the promise and sourcing read models depend on most:

{
"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,
"basis": "THROUGHPUT_CONSTRAINED",
"asOf": "2026-10-22T14:00:00Z",
"feedId": "FEED-20261022-0007"
}
}

The identifiers are synthetic examples; the model fixes no id format.

Consumed​

All four come from node-topology on retailnetwork.node-topology.events (tier logistics, entity node). Proposed consumer group: offer-availability-node-status.

EventFull typeFields usedWhat this context does
NodeRegisteredcom.retailnetwork.logistics.node-topology.node.NodeRegisterednodeId, nodeType, operator, vendorIdInserts the node into NodeStatusView with status PROPOSED (the first state of node-topology's Node).
NodeActivatedcom.retailnetwork.logistics.node-topology.node.NodeActivatednodeId, activatedAtSets the node ACTIVE in NodeStatusView; then, per SuppressOnNodeUnavailable, RestoreListing on every listing of the node suppressed for node unavailability.
NodeSuspendedcom.retailnetwork.logistics.node-topology.node.NodeSuspendednodeId, reason, suspendedAtSets the node SUSPENDED; then SuppressListing on every LIVE listing of the node.
NodeRetiredcom.retailnetwork.logistics.node-topology.node.NodeRetirednodeId, retiredAtSets the node RETIRED; then SuppressListing on every LIVE listing of the node.

NodeRegistered also carries subtype, vendorNodeCode, regionId, timezone, postalCode and countryCode; this context does not use them.

Three more come from seller-inbound on retailnetwork.seller-inbound.events (tier partner), on the consumer group SELLER_INBOUND_CONSUMER_GROUP (service ADRs 0013 and 0014). Every other type on that topic is acknowledged and counted, never dead-lettered.

EventFull typeFields usedWhat this context does
SellerSuspendedcom.retailnetwork.partner.seller-inbound.seller.SellerSuspendedsellerId, suspendedAtSets the seller SUSPENDED in SellerStatusView; every LIVE listing of the owner is suppressed with OWNER_SUSPENDED (gap G48).
SellerReinstatedcom.retailnetwork.partner.seller-inbound.seller.SellerReinstatedsellerId, reinstatedAtSets the seller ACTIVE; every OWNER_SUSPENDED listing of the owner is reconciled: LIVE when no other cause holds, otherwise suppressed with the remaining highest cause.
InboundShipmentReceivedcom.retailnetwork.partner.seller-inbound.inboundshipment.InboundShipmentReceivedsellerId, nodeId, receivedCreates the missing owner listing per received item at availability 0 / UNKNOWN, suppressed when a cause holds; an existing listing is left as it is (gap G51).

As built (service ADR 0015) the context also consumes one event of customer-returns, from retailnetwork.customer-returns.events:

EventFull typeFields usedWhat this context does
ReturnCompletedcom.retailnetwork.commerce.customer-returns.returnauthorization.ReturnCompletedauthorizationId, nodeId, lines, receivedAtPer line, raises the available quantity of the listing of (catalogItemId, nodeId, ownerRef) by qtyRestockable: a delta, not a snapshot. A line with nothing restockable, without a usable item or without a listing is skipped and counted. Unsellable units touch no listing, and no listing is created from a return (policy RestockOnReturnCompleted).

Idempotency and ordering​

  • Inbox. Each consumed CloudEvents id is recorded in processed_events in the same transaction as the view update, the listing changes and their outbox rows. A redelivered id is skipped (conventions.integration_rules: "Every consumer is idempotent on the CloudEvents id").
  • Dispatch on the full type string, never on a suffix.
  • Order per node. node-topology keys by nodeId, so one node's events arrive in order on one partition.
  • Replays are safe. Suppressing a SUPPRESSED listing or restoring a LIVE one is a no-op that raises no event (proposed).

Packaging and owner fields​

Built, ADR 0009 as realized by offer-availability ADR 0006 (catalogue GTIN and packaging hierarchy, and the optional owner of a listing). This section is the delta the seller-inbound design added to this page; where the service decided differently, the text below says so.

CatalogItemPackagingDeclared (entity catalogitem, subject catalogItemId)

FieldTypeMeaning
catalogItemIdstringThe item.
levelenumEACH, INNER, CASE or PALLET: the one level this event declares.
gtinstringThe level's GTIN, 14 digits.
childGtinstring, optionalThe next lower level's GTIN; absent for EACH.
unitsPerPackintegerDirect factor to eaches: at least 2 above EACH, 1 for EACH.
declaredAtRFC 3339 instantWhen the level was declared.

CatalogItemPackLevelRetired (same entity and subject)

FieldTypeMeaning
catalogItemId, level, gtinstringThe level that ends. It is retired (inactive), not deleted, so shipments in flight still validate.
retiredAtRFC 3339 instantWhen the level was retired.

ListingCreated and ListingAvailabilityChanged gain an optional ownerRef (the seller of record; absent means the vendor's own stock). Both are additive, so the :v1 data schema stays v1; no existing consumer reads the field.

Quantities everywhere stay in eaches.