ADR 0016: Start the order-sourcing consumer
Status
Accepted (2026-11-14). Amends ADR 0003 (its list of consumer
group variables) and completes ADR 0012 (the demand half of DemandHeatView).
Context
ADR 0012 has this context read order-sourcing's events to feed the demand half of DemandHeatView
(demand_heat_lines). The pieces were built (SourcingHandlers, NewSourcingConsumer, the use cases
ApplyFulfillmentReleased and ApplyFulfillmentCancelled, the topic constant OrderSourcing, the two types in
apis/asyncapi.yaml) but startBackground in cmd/api/wire_background.go built only the node, catalog and receipt
consumers, cmd/api/config.go listed only three group variables and the chart rendered three. The result: nothing
read retailnetwork.order-sourcing.events, demand_heat_lines was never written and every placement plan was empty,
with no failing test, log line or alert. The README and the docs said so from 2026-11-14.
ADR 0012 names FulfillmentLocked as the observed demand. As built, the demand is the release
(FulfillmentReleasedToNode, one row per released line, the release instant being the CloudEvents time) and its
withdrawal (FulfillmentCancelled); this ADR records that as the as-built contract and does not change it.
Decision
cmd/apistarts a fourth consumer, the sourcing consumer, onretailnetwork.order-sourcing.events(NewSourcingConsumer, started instartBackgroundnext to the other three).- Its group comes from the mandatory variable
SOURCING_CONSUMER_GROUP, exactly like the other three (ADR 0003): no default and no literal group id in code; a missing value is a boot error naming the variable. ADR 0003's list of group variables is thereforeNODE_CONSUMER_GROUP,CATALOG_CONSUMER_GROUP,RECEIPT_CONSUMER_GROUPandSOURCING_CONSUMER_GROUP. - The chart value is
config.sourcingConsumerGroup. It has no default and an empty value refuses to render naming the variable. The cluster value,seller-inbound-order-sourcing, lives inwarehouse-infrahelm-values/seller-inbound.yaml. - The wire contract is unchanged and decoded tolerantly. A merged release (order-sourcing ADR 0015) carries extra
optional fields (
members, per-lineassignmentId,ownerRef) that the decoders ignore; each line of a merged release lands as its own row. A test feeds the golden merged payload shape. - A sensor keeps this from recurring:
TestEveryConsumerConstructorIsStartedFromCmdApi(internal/architecture/consumer_wired_fitness_test.go) fails when aNew*Consumerconstructor declared ininternal/adapters/inbound/kafkais not called fromcmd/api. It failed on the tree before this change, namingNewSourcingConsumer.
Consequences
demand_heat_linesis fed: a release replaces its assignment group's rows, a cancel removes them, a replayed event id is a no-op throughprocessed_events. Placement plans have demand once order-sourcing has released stock (cmd/api/e2e_sourcing_integration_test.go).- A deployment without
SOURCING_CONSUMER_GROUPno longer boots. The chart value must be merged inwarehouse-infrabefore the chart version that renders it is deployed; the infra key was merged first and is ignored by a chart that does not know it. - A
kafka-gogroup consumer that starts before its topic exists never picks it up later (fleet gap row 45). The pod must be restarted afterretailnetwork.order-sourcing.eventsexists; this is not solved here. - Placement plans computed before the consumer ran stay empty; a new
POST /placement-planssupersedes them.