Skip to main content

Domain Events

Every event this context publishes, with its full CloudEvents type, and the (empty) list of events it consumes. The envelope rules are the domain-wide event standard.

Envelope​

AttributeValue
specversion1.0 (structured JSON, mandatory on every Kafka message)
ida UUID minted once when the outbox row is written; a relay retry re-sends the same id
source/retailnetwork/node-topology
typecom.retailnetwork.logistics.node-topology.<entity>.<EventName>; tier logistics; entity node, lane, servicearea or region
subjectthe aggregate root id: nodeId, laneId, postalPrefix or regionId
timethe instant the change was committed, UTC
datacontenttypeapplication/json
dataschemaurn:retailnetwork:node-topology:events:<EventName>:v1
Topicretailnetwork.node-topology.events
Kafka keythe same aggregate root id as subject, so one aggregate's events stay in order on one partition

Every event leaves through a transactional outbox, written in the same transaction as the aggregate (internal/adapters/outbound/postgres/outbox_repository.go, ADR 0005).

Source: internal/adapters/kafka/cloudevents/cloudevents.go, internal/adapters/outbound/kafka/encoder.go, payloads.go, internal/domain/*/events.go and apis/asyncapi.yaml.

Published​

Summary​

EventFull typeSubject / keyProducing commandConsumers
NodeRegisteredcom.retailnetwork.logistics.node-topology.node.NodeRegisterednodeIdRegisterNodeoffer-availability, delivery-promise, order-sourcing, linehaul-transportation, last-mile-delivery, node-performance, vendor-connectivity, seller-inbound
NodeOperationalProfileDeclaredcom.retailnetwork.logistics.node-topology.node.NodeOperationalProfileDeclarednodeIdDeclareOperationalProfiledelivery-promise, order-sourcing, linehaul-transportation, node-performance, vendor-connectivity, seller-inbound
NodeActivatedcom.retailnetwork.logistics.node-topology.node.NodeActivatednodeIdActivateNodeoffer-availability, delivery-promise, order-sourcing, linehaul-transportation, vendor-connectivity, seller-inbound
NodeSuspendedcom.retailnetwork.logistics.node-topology.node.NodeSuspendednodeIdSuspendNodeoffer-availability, delivery-promise, order-sourcing, linehaul-transportation, vendor-connectivity, seller-inbound
NodeRetiredcom.retailnetwork.logistics.node-topology.node.NodeRetirednodeIdRetireNodeoffer-availability, delivery-promise, order-sourcing, linehaul-transportation, vendor-connectivity, seller-inbound
LaneOpenedcom.retailnetwork.logistics.node-topology.lane.LaneOpenedlaneIdOpenLanelinehaul-transportation, delivery-promise, order-sourcing
LaneClosedcom.retailnetwork.logistics.node-topology.lane.LaneClosedlaneIdCloseLanelinehaul-transportation, delivery-promise, order-sourcing
LaneCostDeclaredcom.retailnetwork.logistics.node-topology.lane.LaneCostDeclaredlaneIdDeclareLaneCostorder-sourcing
ServiceAreaAssignedcom.retailnetwork.logistics.node-topology.servicearea.ServiceAreaAssignedpostalPrefixAssignServiceAreadelivery-promise, order-sourcing, last-mile-delivery
RegionDefinedcom.retailnetwork.logistics.node-topology.region.RegionDefinedregionIdDefineRegiondelivery-promise, order-sourcing

The consumer column is the network model's subscriber list (see Integration); this repository cannot see its consumers. node-performance subscribes to NodeRegistered and NodeOperationalProfileDeclared but its handlers have no effect: they acknowledge the event and write only the inbox row (NodeTopologyHandlers and noEffect in node-performance internal/adapters/inbound/kafka/handlers.go). The field lists below are the payload structs in internal/adapters/outbound/kafka/payloads.go; the event catalogue is the consumer-facing summary.

NodeRegistered​

Producing use case: RegisterNode. What consumers do with it: build their node read models (NodeStatusView, NodeProfileView, StationView, VendorNodeView).

FieldTypeMeaning
nodeIdstringThe network's id of the node
nodeTypeenumFULFILLMENT_CENTER, INBOUND_CROSS_DOCK, RETURNS_CENTER, SORTATION_CENTER, DELIVERY_STATION, AIR_HUB
subtypeenum, nullableA FULFILLMENT_CENTER subtype; null otherwise
operatorenumNETWORK or VENDOR
vendorIdstring, nullableSet when operator is VENDOR
vendorNodeCodestring, nullableThe vendor's own code; set when operator is VENDOR
regionIdstringThe node's region
timezonestringIANA time zone of the building
postalCodestringPostal code of the building
countryCodestringISO 3166-1 alpha-2

Capabilities are not on the wire: consumers derive them from nodeType (policy DefaultCapabilitiesByType, model node_types).

NodeOperationalProfileDeclared​

Producing use case: DeclareOperationalProfile. What consumers do with it: linehaul-transportation (re)generates pickup departures per cutoff (PickupFromCutoffs); delivery-promise and order-sourcing update NodeProfileView (handling time, cutoffs, throughput cap). node-performance consumes it without effect: only its inbox row is written, no scorecard reads the declaration.

FieldTypeMeaning
nodeIdstringThe node
profileRevisionintegerStrictly increasing per node
timezonestringIANA time zone the local times are in
operatingHoursByDayobject{monday … sunday: {start, end}}, local times as HH:mm; a missing day is closed
holidaysarray of ISO datesDays the node is closed all day
handlingTimeMinutesintegerDeclared time from order release to a package ready for handover
cutoffsarray of {localTime, days?, maxOrders?}localTime (HH:mm) is when packages are ready for handover; days lists the weekdays it applies to (default: every operating day); maxOrders optional
throughputCap{value, timeUnit, unit}Maximum orders per time unit; value is an integer above zero, timeUnit is HOUR or DAY, unit is ORDER
sortDwellMinutesinteger, optionalDeclared sort dwell; present only for SORTATION_CENTER and AIR_HUB nodes
inboundobject, optionalBuilt (ADR 0007): {maxCartonWeightG, maxCartonDimsMm{l,w,h}, acceptsPallets, requiresSscc}, each member optional; present only when the revision declares limits. Not gated on the INBOUND capability: the code accepts limits on any node type. Additive: a consumer that ignores it is unaffected.
declaredByenumVENDOR or NETWORK_OPS

NodeActivated​

Producing use case: ActivateNode. Consumers mark the node sellable and promisable; offer-availability restores listings it suppressed for the node's unavailability.

FieldTypeMeaning
nodeIdstringThe node
activatedAttimestampWhen it became ACTIVE

NodeSuspended​

Producing use case: SuspendNode. offer-availability suppresses the node's listings; linehaul-transportation cancels future pickups.

FieldTypeMeaning
nodeIdstringThe node
reasonstringWhy the planner suspended it
suspendedAttimestampWhen it became SUSPENDED

NodeRetired​

Producing use case: RetireNode. Same reactions as NodeSuspended, for good.

FieldTypeMeaning
nodeIdstringThe node
retiredAttimestampWhen it became RETIRED

LaneOpened​

Producing use case: OpenLane. linehaul-transportation may schedule departures on it; delivery-promise and order-sourcing add it to their graph.

FieldTypeMeaning
laneIdstringThe lane
originNodeIdstringOrigin node
destinationNodeIdstringDestination node
modeenumGROUND or AIR
nominalTransitMinutesintegerNominal transit time

LaneClosed​

Producing use case: CloseLane.

FieldTypeMeaning
laneIdstringThe lane
closedAttimestampWhen it closed

LaneCostDeclared​

Producing use case: DeclareLaneCost (ADR 0014). Raised on every declaration; a newer declaration supersedes the previous value, and a lane never declared on publishes nothing. order-sourcing keeps the latest declaration per laneId and folds it into its money-denominated assignment cost.

FieldTypeMeaning
laneIdstringThe lane
costPerUnitCentsintegerThe declared marginal cost of moving one package-unit across the lane on one departure, in cents, 0 to 10000000
declaredAttimestampWhen the cost was declared

ServiceAreaAssigned​

Producing use case: AssignServiceArea.

FieldTypeMeaning
postalPrefixstringThe postal prefix
deliveryStationNodeIdstringThe DELIVERY_STATION that serves it
regionIdstringThe station's region
assignmentVersionintegerStrictly increasing per prefix; consumers keep the highest

RegionDefined​

Producing use case: DefineRegion.

FieldTypeMeaning
regionIdstringThe region
codestringUnique short code
namestringDisplay name

Example envelope​

NodeOperationalProfileDeclared is the event most decisions downstream depend on: pickup departures, promise cutoffs and the throughput cap all come from it. One complete envelope, with illustrative values:

{
"specversion": "1.0",
"id": "3f6c2a9e-8b1d-4c7a-9e55-0d2f6b7a1c44",
"source": "/retailnetwork/node-topology",
"type": "com.retailnetwork.logistics.node-topology.node.NodeOperationalProfileDeclared",
"subject": "node-0f3a91",
"time": "2026-10-22T13:05:12Z",
"datacontenttype": "application/json",
"dataschema": "urn:retailnetwork:node-topology:events:NodeOperationalProfileDeclared:v1",
"data": {
"nodeId": "node-0f3a91",
"profileRevision": 3,
"timezone": "America/Sao_Paulo",
"operatingHoursByDay": {
"monday": {"start": "06:00", "end": "22:00"},
"tuesday": {"start": "06:00", "end": "22:00"},
"wednesday": {"start": "06:00", "end": "22:00"},
"thursday": {"start": "06:00", "end": "22:00"},
"friday": {"start": "06:00", "end": "22:00"},
"saturday": {"start": "08:00", "end": "14:00"}
},
"holidays": ["2026-12-25"],
"handlingTimeMinutes": 240,
"cutoffs": [
{"localTime": "11:00"},
{"localTime": "18:00", "days": ["monday", "tuesday", "wednesday", "thursday", "friday"], "maxOrders": 1200}
],
"throughputCap": {"value": 400, "timeUnit": "HOUR", "unit": "ORDER"},
"declaredBy": "VENDOR"
}
}

The values are illustrative. Sunday is absent, so the node is closed on Sunday. The 11:00 cutoff has no days, so it applies to every operating day (Monday to Saturday); the 18:00 cutoff names Monday to Friday because Saturday closes at 14:00 (ErrCutoffOutsideOperatingHours). The example is a fulfillment centre, so it carries no sortDwellMinutes (ErrSortDwellNotAllowed).

Consumed​

None. The context has no Kafka consumer, no consumer group and no inbox table to dedupe in (ADR 0003). Its inputs are the REST commands listed on Use cases.

Analytics​

Nothing is published on retailnetwork.node-topology.analytics: the only topic the relay writes is retailnetwork.node-topology.events.