Skip to content
Hiep Lam
Go back

Event Notification vs. Direct Sync Push: Who Should Depend on Whom?

Edit page

TL;DR


1. The setup

A generalized architecture study. The concrete trigger was a fintech-lender setup where an upstream Facade service (abstracts all bank-data complexity for the whole platform - statements, balances, credit signals) must tell a downstream CRM that a customer connected a new bank. “Salesforce” appears as the concrete CRM example because its real platform limits change the analysis. The pattern generalizes to any generic upstream → specific downstream notification.

Approach 1 - Event notification + callback (thin event / claim-check):

Bank connects → Facade persists → Facade publishes "BankConnected{customerId, connectionId}" (thin)
   → bus → CRM subscriber consumes → CRM calls Facade GET /connections/{id}
      → Facade returns full detail → CRM upserts record

On the wire: IDs only on the bus; sensitive payload travels over one authenticated callback, read fresh at consume time.

Approach 2 - Direct synchronous API push (command):

Bank connects → Facade persists → Facade calls CRM POST /bankinfo {full payload}
   → CRM writes record → returns 200/4xx/5xx

On the wire: full payload, a point-in-time snapshot, pushed straight into the CRM. The Facade holds CRM credentials + schema and must handle the CRM being slow or down.


2. Pros & cons by dimension

Legend: A1 = event+callback, A2 = direct push, ↔ = depends.

Coupling & dependency direction → Tilts A1 (strongly)

A1A2
ProsFacade publishes a fact, knows nothing about consumers; CRM depends on Facade (healthy: specific→generic). Temporal decoupling. New consumers self-serve.One fewer indirection; call path reads top-to-bottom.
ConsCRM must know event schema and callback API (two contracts); needs CRM→Facade connectivity.Generic facade must know the specific CRM (endpoint, auth, schema, quirks). Grows to O(N) integrations / distributed monolith. Tight temporal coupling.

Delivery guarantees & reliability → Tilts A1

A1A2
ProsDurable, at-least-once delivery + NServiceBus recoverability (immediate + delayed retries → error/DLQ). CRM can be down at publish.Immediate in-band success/failure signal.
ConsDuplicates possible (needs idempotent upsert); more infra in the path.You hand-roll retries/backoff/dead-lettering/durability. Fire-and-forget failure = lost; inline retry couples Facade latency to CRM; background retry = reinventing the bus, worse.

Consistency, freshness, ordering, idempotency → Tilts A1

A1A2
ProsCallback reads latest state at consume time → self-healing against missed/stale/reordered events (event = “come look”). Idempotency natural via upsert on connectionId.Strong immediate read-your-write in CRM on happy path; no callback staleness window.
ConsEventual consistency window (sub-second–seconds). Bus ordering not guaranteed across partitions without sessions/partition keys.Snapshot can overwrite newer state if retried/late (lost update). Reordered connect/disconnect can land out of order with no re-pull safety net. Duplicates need explicit keys.

Latency & timeliness → ↔ (A2 faster happy-path; A1 fine for “seconds”)

A1A2
ProsFacade’s connect txn returns immediately (just publish).Single hop = lowest end-to-end latency; best when a human waits now.
ConsBus hop + consume + callback round-trip (still typically seconds).Adds CRM latency to Facade’s critical path if inline; CRM tail latency becomes Facade tail latency.

Scalability, load, backpressure & fan-out → Tilts A1 (strongly at scale)

A1A2
ProsPublish once, N consumers. Queue buffers bursts; consumers drain at their own rate (free backpressure).Trivial at tiny volume with one consumer.
ConsBurst can stampede the callback endpoint (thundering herd) - mitigate with caching/ETags/concurrency caps.No buffer - spikes hit the CRM directly, burning Salesforce daily API request quota + the ~25 concurrent long-running-request cap; 429s must be handled. Fan-out to M consumers = M calls per event.

Failure modes, blast radius & isolation → Tilts A1 (strongly)

A1A2
ProsFailures isolated behind the bus; poison message → DLQ without touching the Facade; one broken consumer doesn’t affect others (bulkheading).Failures visible synchronously and immediately.
ConsDLQ triage is its own skill.CRM outage/slowness directly degrades the Facade (thread/connection exhaustion, cascading failure into a core shared service). “One bad downstream takes down the facade” - canonical anti-pattern.

Security & data sensitivity (financial PII) → Tilts A1 (thin) / ↔ vs fat-event

A1 (thin)A2
ProsData minimization: only IDs on the broker; payload over one authenticated, least-privilege callback, fetched fresh. Smaller leak blast-radius.Direct TLS channel; data never sits on a broker.
ConsBank data traverses the CRM→Facade callback; CRM needs read creds.Full payload in flight + at rest in CRM; broader exposure, more compliance surface. (A fat-event hybrid would also put PII on the bus.)

Operational complexity, infra, cost & observability → Tilts A2

A1A2
ProsIf you already run NServiceBus/Azure Service Bus, marginal cost is low; DLQ/retry tooling exists.Simplest possible: “just an HTTP call.” No broker to run/pay/monitor. Single call stack = trivial tracing.
ConsMore moving parts (topic/subscription, endpoint config, DLQ monitoring, callback API). Tracing across an async hop needs correlation IDs.You must build the observability/retry/idempotency the bus gives free - and that home-grown layer is what rots.

Evolvability, versioning, contract ownership & extensibility → Tilts A1 (strongly)

A1A2
ProsFacade owns one event + one fetch API for everyone. New consumer = new subscription, zero facade change. Additive event versioning is well-trodden.One contract for the single case.
ConsTwo contracts to version; consumers invisible to producer (need schema registry / contract tests).Per-consumer integration code in the facade → O(N) maintenance, integration spaghetti, facade redeploys for downstream changes.

Dimensions the two-way framing misses


3. Failure-scenario walkthroughs

ScenarioA1 (event+callback)A2 (direct push)
CRM downEvent waits durably; CRM drains on recovery. Facade unaffected.Call fails. Inline → Facade flow degrades; background → must own a retry store or notification is lost.
Facade downNothing published (correct); with outbox, pending event publishes on recovery.Connect didn’t happen → nothing to push (symmetric).
Burst/spikeQueue buffers; consumers drain at pace. Risk: callback thundering herd → cache/concurrency caps.No buffer; CRM hammered, burns daily API quota, hits concurrency cap, 429s to back off on.
Poison messageRetried then parked in DLQ; rest of stream flows.No DLQ - block forever, drop, or build bespoke quarantine.
Duplicate (at-least-once)Idempotent upsert on connectionId → no-op.Needs idempotency key or risks double-write/overwrite.
Out-of-order connect/disconnectCallback re-reads current truth → converges.Snapshot ordering can land stale; needs version/timestamp guards.
CRM hits governor limitIndirect: only CRM’s outbound callout + write consume limits; bus throttles naturally.Direct: every connect consumes inbound API quota; sustained volume can exhaust the org’s daily budget and block other integrations.

4. The dependency-direction insight (the one to internalize)

A facade exists to be the single place that abstracts complexity for everyone. A2 makes that generic, shared, upstream service hold a hard-coded dependency on one specific downstream - its URL, auth, schema, uptime, rate limits. One integration today; three consumers = three sets of outbound code, three credentials, three failure modes, three reasons to redeploy the facade when a downstream changes. That is how a clean facade decays into a distributed monolith.

A1 inverts the arrow: the facade states a fact once; each consumer owns its dependency on the facade and its own reaction. The generic service stays generic. Hence: for a facade with a growing consumer set, event-notification is the default and direct push is the exception you justify.


5. Third / hybrid options

OptionWhatWhenTrade-off
Event-carried state transfer (fat event)Event carries full info; no callback.Want A1 decoupling but not the callback / downstream→facade connectivity; sensitivity acceptable.PII on the bus; larger messages; snapshot can be stale; tighter schema coupling.
Transactional OutboxWrite event in same DB txn as the connect; relay publishes.Whenever the facade publishes events.Small infra (outbox table + dispatcher); ~mandatory to avoid dual-write loss.
iPaaS / middlewareEvent → integration layer → CRM via Bulk/Composite API.Keep CRM API quirks/batching/quota out of the facade.Another platform to own/pay; added hop.
Salesforce Platform EventsPublish a platform event into the CRM; it reacts internally.CRM team prefers native pub/sub; offload retry to the platform.CRM-specific; daily event-delivery allocations.
Event + cached/conditional callbackThin event; callback uses caching/ETags + concurrency limits.A1 at high burst volume.Extra caching logic.
Event + periodic reconciliationA1 as primary + scheduled drift sweep.High-assurance financial correctness.Extra batch job.

6. Strongest case for each (steelman)

For A2 (direct push): exactly one consumer now and foreseeable, low volume (a bus is over-engineering for 1:1); a human expects the record updated instantly; you want synchronous confirmation in-band; minimal infra/cognitive load.

For A1 (event+callback): ≥2 consumers (or expected); need failure isolation + guaranteed delivery + buffering for free; keeping the facade generic is a goal; want freshest data / self-healing; you already run the bus.


7. Decision framework (no single verdict)

Lean A1 when most hold: >1 downstream now or within ~12–24mo · facade must stay consumer-agnostic · isolation + guaranteed delivery > instant confirmation · “updated within seconds” is fine · want PII kept off the bus.

Lean A2 when most hold: exactly one consumer, low/steady volume · human-in-the-loop needs near-synchronous update · synchronous confirmation materially simplifies error handling · you don’t want to own messaging for this flow · downstream→facade callouts are hard.

Lean hybrid when: want A1 decoupling but callback is awkward → fat event (mind PII) · the facade publishes events at all → add Outbox regardless · downstream API quotas/batching are a headache → iPaaS.


8. Key open questions that flip the decision

  1. Consumer count now and in 12–24mo? (biggest lever)
  2. Latency SLA - <1s (human waiting) or seconds–minutes fine?
  3. Volume / burst vs the CRM’s daily API budget + concurrency cap?
  4. Data-on-bus policy - is PII allowed on the broker? (thin vs fat event)
  5. Contract & on-call ownership - who owns it, who’s paged?
  6. Existing events - does the facade already publish domain events? (if yes, A1 ~free)
  7. Transactional integrity - is the connect write transactional with the notify? (→ outbox)
  8. Downstream→facade connectivity - can the CRM reliably call back within its callout limits? (if not → favor fat event / push)

One-line takeaways

  • It’s async-decoupled-pull vs sync-coupled-push and who-knows-whom - the second usually decides it for a facade.
  • Direct push from a generic facade to a specific downstream is the smell to watch: O(N) integrations, cascading failure, distributed monolith.
  • Thin-event + callback = freshest data + PII off the bus + self-healing; the cost is a second round-trip and async debugging.
  • Whatever you pick, if the facade emits events, use a Transactional Outbox; the dual-write will bite otherwise.

Edit page
Share this post:

Previous Post
Trunk-Based Development vs 'Release-Please': Three Problems Teams Mistake for One
Next Post
The EF Core Livelock That Looks Like a Hang: Stale ChangeTracker State and the Atomic-Claim Fix

Keep reading

A few more pieces in the same vein.

Rather read on your own time? Subscribe via RSS