7. Downstream change notification: change-feed outbox and message bus
7. Downstream change notification: change-feed outbox and message bus
Date: 2026-10-26
Status
Accepted
Problem
The brief asks for "timely visibility into important changes" and notes that downstream systems must learn when data changes. The architect suggested an outbox pattern and asked for a brainstorm against webhooks and real-time transport (WebSockets, SignalR, Server-Sent Events in .NET). Two different needs hide here:
- System-to-system: another system must react to a change (re-score a lead, refresh a cache, start a workflow). Needs durability, retries, dead-lettering, idempotency, and a contract.
- Human and UI: a dashboard tile updates, a Teams message is sent, an email goes out. Needs low latency and fan-out, tolerates loss.
A textbook outbox writes the event row in the same database
transaction as the business row. Delta Lake commits are atomic per
table, not across tables, so a gold.fact write and a
gold.outbox write cannot share one transaction. Something
else has to play the role of the transaction log.
The architect's reference for the downstream half is a statistical
reporting platform at a public-sector agency, where "downstream" meant
generated reports delivered to an external institution with sign-off,
lineage and revision cycles. That half is handled by ADR 11
(publication pipeline). This record covers system-to-system and human
notification of changes, which the publication pipeline also consumes
(metrics.restated triggers re-publication).
Decision
We will use the Delta Change Data Feed as the outbox log, a relay that publishes changes to an Azure Service Bus topic, and adapters that subscribe to that topic for each delivery style.
- Business events are data. A Tier 1 event job, run
every 15 minutes after the Silver jobs, evaluates the "important change"
rule set (business
architecture) over the Silver change feed, carries the subject's
vault token (assigned at the Bronze gate, so no identifier is ever
involved), and inserts rows into
gold.business_event(event type, subject key, generalised before and after values, occurred-at, source version) if absent on a deterministicevent_id = hash(event_type, subject_key, source_version, rule_version). The hourly and nightly star builds add aggregate-level events (for examplespend.pacing_alert,metrics.restated) the same way. Change Data Feed is enabled onbusiness_eventand on Silver tables, not on Gold facts, whose day-level rebuilds would appear as whole-day churn. - CDF is the outbox. The event row is persisted
exactly once, in
business_event; the change feed of that table is the log the relay reads, so there is no separate outbox write to keep consistent with an event table. A crash between a Silver write and the event job leaves events to be produced by the next run, which is idempotent because the ids are deterministic. The relay readstable_changes('gold.business_event', last_version + 1)after each event job and star build, publishes each row, and stores the last published version incontrol.outbox_cursor. If the relay crashes after publishing and before storing the cursor, the next run republishes; consumers deduplicate onevent_id. - Service Bus topic
data-changedwith one subscription per consumer, SQL filters on event type, duplicate detection onevent_id(10-minute window), dead-letter queue per subscription, sessions keyed by subject where ordering per entity matters. Volume is thousands of events per hour at most; this is a messaging workload, not telemetry. - Adapters (each a subscriber, none called by the
pipeline):
- Webhook dispatcher (.NET on Azure Functions): subscriber registry (URL, secret, event filter, active flag), HMAC-signed payload, exponential retry, dead-letter after N attempts, delivery log. External systems register once; nothing in the pipeline knows they exist.
- Push gateway for UIs (.NET 10 ASP.NET Core):
Server-Sent Events via
TypedResults.ServerSentEventsfor one-way dashboard updates (simplest, HTTP-native, auto-reconnect withLast-Event-ID); Azure SignalR Service or Web PubSub if bidirectional messaging or very large fan-out appears. The gateway is itself a Service Bus subscriber. - Fabric Activator for human notifications: an eventstream sourced from the Service Bus topic feeds Activator rules that send Teams messages or email, or trigger a Fabric pipeline (for example, reframe the semantic model, or run a downstream Dataflow). Fabric job events (failed runs) also go to Activator. Caveat: the Service Bus eventstream source authenticates with a shared access key (no managed identity) and is not covered by Git integration or deployment pipelines today, so that key lives in Key Vault and the eventstream is configured per environment by runbook, as a documented exception to "everything as code".
- Pull remains available. Batch consumers may read
Gold through the SQL analytics endpoint or read the
business_eventchange feed directly with a version cursor. This is the cheapest integration for consumers that run nightly.
Considered Options
| Option | Summary | Pros | Cons |
|---|---|---|---|
| ✅ CDF-derived outbox → Service Bus topic → adapters | Transaction-log tailing variant of the outbox | No dual write; replayable by version; durable fan-out with per-consumer DLQ; webhooks, SSE and Teams are all adapters of one bus | Relay and cursor to operate; Service Bus is one more Azure resource |
| Classic outbox table written by the Gold jobs | Job writes gold.outbox after writing facts, with ids
minted per run |
Familiar | Event rows are a second commit with no way to regenerate what was lost between the two, and run-minted ids duplicate on every re-run. The chosen design keeps the single event table but derives ids from Silver versions, so the table is regenerable and re-runs are no-ops. Rejected in its non-deterministic form. |
| Direct webhooks from the pipeline | Pipeline Web activity calls each consumer | Nothing to deploy | Pipeline knows every consumer; a slow consumer slows ingestion; retries and DLQ reinvented per call. Rejected (violates AP-03). |
| Azure Event Grid custom topic | Push to HTTP endpoints with retry and dead-letter | Cheaper per event than Service Bus for pure webhooks; native push | No sessions or ordering; weaker dedupe; consumers must be HTTP endpoints. Viable if every consumer is a webhook; Service Bus chosen for the mixed case. |
| Azure Event Hubs | Partitioned log | Millions of events per second; replay by offset | Overkill at thousands per hour; consumers must manage checkpoints; no DLQ. Reserve for a future clickstream source. |
| Fabric Activator only | Rules on OneLake or eventstream events | No Azure resources; great for Teams and email and for triggering Fabric items | Not a system-to-system contract: no durable delivery guarantees to external endpoints beyond Power Automate; OneLake events are file-level, not row-level. Kept for human alerts and Fabric orchestration. |
| Consumers poll Gold or CDF | No push at all | Simplest; good for nightly consumers | Does not meet "timely visibility" for systems that need minutes. Kept as the batch option. |
| WebSockets or SignalR directly from the pipeline | Pipeline pushes to UI | Lowest latency | Pipeline coupled to UI sessions; no durability. SSE/SignalR kept, but only as a subscriber of the bus. |
Consequences
Positive:
- One place to add a consumer (a subscription), one place to see delivery failures (its DLQ).
- Replay of events for a consumer is
table_changesfrom an older version, with no reprocessing of data. - "Important change" rules are versioned data logic in Git, reviewed by the business.
Negative / Trade-offs:
- Event latency equals the 15-minute Tier 1 cycle (poll, Silver, event job, relay) plus processing: the target is 30 minutes end to end from the source change, and minutes when a webhook or CDC nudge lands the change before the next cycle. Sub-minute needs would require event-triggered Silver runs.
- Replay never re-emits already-published events (deterministic ids),
and a restatement emits only
metrics.restated. A consumer that wants history re-reads the change feed from an older version through its own subscription cursor; this policy is the default and is open for the consumers to challenge. - Payloads carry vault tokens, never identifiers; a consumer that needs an identity must use the vault's reverse-lookup API under its own access review (ADR 6).
Risks: | Risk ID | Description | Impact (E/H/M/L) |
Mitigation | |---------|-------------|------------------|------------| |
R1 | VACUUM removes CDF files before the relay has read them | M | Relay
runs after each event job and star build; VACUUM retention on Gold is 30
days; alert if cursor lag exceeds 1 day | | R2 | A consumer requires
exactly-once | L | Documented at-least-once contract;
event_id dedupe on both sides | | R3 | SSE connections
buffered by a proxy | L | Disable response buffering on the gateway
route; fall back to SignalR if infrastructure cannot stream |
Related
- Related ADRs: 2, 5, 8
- Related requirements: Timely visibility into important changes; Architecture evolution
- Related documents: event contracts, sequence: downstream notification
- Principles: AP-03, DP-04, TP-01
- TOGAF phase: C (Application)
- Decision maker(s): Lead Architect
- Stakeholders: Owners of downstream systems, Marketing Operations