Acme Marketing Architecture

Sequence: downstream change notification

Sequence: downstream change notification

Change Data Feed on gold.business_event is the outbox log; the relay publishes to a Service Bus topic; every delivery style is a subscriber.

sequenceDiagram
    autonumber
    participant GJ as Gold jobsss
    participant G as gold.business_event (CDF)
    participant RL as Relay
    participant C as control.outbox_cursor
    participant SB as Service Bus topic data-changed
    participant WD as Webhook dispatcher
    participant EXT as External system
    participant SSE as Push gateway
    participant UI as Dashboard
    participant ACT as Activator
    GJ->>G: insert events if absent on deterministic event_id
    RL->>C: read last_published_version
    RL->>G: table_changes(last+1 .. current)
    RL->>SB: publish (MessageId=event_id, SessionId=subject)
    RL->>C: last_published_version = current
    par subscribers
        SB->>WD: lead.qualified
        WD->>EXT: POST signed payload
        alt 2xx
            WD->>WD: delivery_log ok
        else 5xx or timeout
            WD->>WD: retry with backoff, then DLQ
        end
    and
        SB->>SSE: lead.qualified
        SSE-->>UI: text/event-stream (id=event_id)
    and
        SB->>ACT: eventstream
        ACT->>ACT: rule, then Teams message
    end
    Note over RL,SB: crash after publish, before cursor update: republish, consumers dedupe on event_id

Guarantees

Property How
No lost events Events are derived deterministically from Silver versions, so a failed event job is repaired by the next run; relay cursor advances only after publish
No dual write There is no separate outbox write; the change feed of the single event table is the log
At-least-once, deduplicated Service Bus duplicate detection on MessageId; consumers dedupe on event_id
Ordering per subject Sessions keyed by subject on subscriptions that need it
Replay for a consumer Reset its cursor to an older version and re-run the relay for that subscription
Privacy Payloads originate from Gold; no direct identifiers