Acme Marketing Architecture

Dynamic — Downstream change notification

Dynamic — Downstream change notification

Diagram type: Dynamic (C4 supporting diagram) Scope: one business event travelling from the Gold jobs to a webhook subscriber, a dashboard and a Teams channel. Audience: developers of downstream consumers; reviewers checking the outbox design. Structurizr view: Dynamic-DownstreamNotification in structurizr/workspace.dsl Branches (retry, dead-letter, crash between publish and cursor update) are in sequence-downstream-notification.md.

Overview

There is no separately written outbox table. The Tier 1 event job inserts business events into one table if absent on a deterministic id (step 1); the relay reads that table's Change Data Feed from the last published version (steps 2–3), publishes to the Service Bus topic with the event id as message id (step 4), and only then advances the cursor (step 5). Each delivery style is a subscription on the topic (steps 6–11); none of them is called by the pipeline.

Diagram

C4Dynamic
    title Dynamic diagram - Downstream change notification
    Container(goldjob, "Gold jobs", "Fabric notebook, Spark")
    ContainerDb(gold, "lh_gold", "Fabric Lakehouse; business_event with CDF")
    Container(relay, "Relay", "Fabric notebook")
    ContainerDb(silver, "lh_silver and control", "outbox_cursor")
    ContainerQueue(sb, "Service Bus", "data-changed topic")
    Container(disp, "Webhook dispatcher", "Azure Functions")
    Container(sse, "Push gateway", "ASP.NET Core SSE")
    Container(act, "Activator", "Fabric Real-Time Intelligence")
    System_Ext(down, "Downstream systems", "Webhook endpoint; dashboard")
    System_Ext(teams, "Microsoft Teams and Exchange", "Notifications")

    Rel(goldjob, gold, "Insert business events if absent on deterministic event_id", "Delta MERGE")
    Rel(relay, silver, "Read last_published_version from outbox_cursor", "Delta")
    Rel(relay, gold, "Read table_changes(last+1 to current)", "Delta CDF")
    Rel(relay, sb, "Publish events (MessageId=event_id, SessionId=subject key)", "AMQP")
    Rel(relay, silver, "Advance last_published_version", "Delta")
    Rel(sb, disp, "Deliver lead.qualified to the dispatcher subscription", "AMQP")
    Rel(disp, down, "POST HMAC-signed payload; retry with backoff; dead-letter after 8 attempts", "HTTPS, JSON")
    Rel(sb, sse, "Deliver to the dashboard subscription", "AMQP")
    Rel(sse, down, "Stream text/event-stream with id=event_id", "SSE over HTTPS")
    Rel(sb, act, "Feed the Activator eventstream", "eventstream source")
    Rel(act, teams, "Send a Teams message per rule", "Microsoft Graph")

Legend

Elements

Element Type Technology Responsibility in this flow
Gold jobs Container Fabric notebooks The Tier 1 event job writes business_event rows every 15 minutes; the star build adds aggregate-level events
lh_gold ContainerDb Fabric Lakehouse, CDF on Source of the change feed
Relay Container Fabric notebook, Python Reads CDF; publishes; advances cursor
lh_silver and control ContainerDb Fabric Lakehouse outbox_cursor
Service Bus ContainerQueue Azure Service Bus Standard Topic with subscriptions, duplicate detection, DLQs
Webhook dispatcher Container Azure Functions Signed delivery, retry, DLQ
Push gateway Container ASP.NET Core, .NET 10 SSE stream
Activator Container Fabric Real-Time Intelligence Rules to Teams and email
Downstream systems, Teams External systems — Receive

Key relationships

See the numbered arrows. Event payload contract: integration contracts.

Notable architectural decisions

Assumptions