Skip to content
Enterprise CRM·11 min read·November 19, 2026

Event-Driven Salesforce Architecture: Change Data Capture (CDC) & Platform Events with Apache Kafka

How to decouple high-throughput enterprise systems from Salesforce governor limits using Change Data Capture (CDC), high-volume Platform Events, and Apache Kafka pub/sub consumers with reliable message delivery.

A
By Anjali
·November 19, 2026·4 min read
Architecture Note
Event-Driven Salesforce Architecture: Change Data Capture (CDC) & Platform Events with Apache Kafka

1. The Anti-Pattern: Synchronous Point-to-Point Sync & Governor Limit Exhaustion

In high-volume enterprise organizations, integrating Salesforce with external ERPs, data warehouses, and customer web applications via synchronous REST or SOAP calls is an architectural anti-pattern. Every synchronous call ties up Apex worker threads, consumes valuable daily API allocations, and exposes the CRM to third-party network latency.

During traffic surges (such as flash marketing sales or fiscal quarter-end reporting), synchronous integration calls fail with Apex CPU timeouts (Apex CPU time limit exceeded) or multitenant governor limit breaches. As detailed in our B2B Salesforce Quoting Case Study, synchronous failures risk permanent record drop and unrecoverable lead attribution errors.

Event-Driven Data Pipeline Connecting Salesforce CDC to Apache Kafka
Architecture diagram illustrating delta-only Change Data Capture payloads streaming into Kafka multi-broker partitions.
Cloud Consultancy Engineering Note

To eliminate governor limit contention, modern architects transition to an asynchronous event-driven architecture (EDA), decoupling Salesforce orgs through native pub/sub streaming.

2. Decoupled Pub/Sub: Change Data Capture (CDC) vs High-Volume Platform Events

Salesforce provides two native streaming primitives on its multitenant event bus:

  • •Change Data Capture (CDC): Automatically emits granular JSON/Avro mutation events whenever an sObject record (such as Lead, Account, or Opportunity) is created, updated, deleted, or undeleted. Crucially, CDC sends delta-only field payloads, drastically reducing network serialization overhead.
  • •High-Volume Platform Events: Custom event definitions tailored for application-specific notifications, cross-cloud messaging, and high-frequency webhook ingestion without touching persistent database tables.

By leveraging the Salesforce Pub/Sub API (backed by high-performance gRPC and CometD), external consumers subscribe to event channels without consuming standard synchronous REST API credits. Learn more about our specialized implementation standards on our dedicated Salesforce Consulting & LWC Engineering Practice page.

3. Resilient Ingestion: Emp-Connector, Kafka Partitions & Replay ID Retention

The central challenge in real-world streaming pipelines is handling network disconnects, worker crashes, and scheduled seasonal Salesforce maintenance windows without dropping a single event.

Replay ID Checkpoint Telemetry and Automatic Reconnection Stream
Engineering telemetry showing Redis Replay ID checkpoints recovering 14,820 buffered events with reliable message delivery.
Cloud Consultancy Engineering Note

The Salesforce event bus stores published events for 72 hours. Each event carries an opaque, monotonically increasing Replay ID. By persisting the latest committed Replay ID in Redis or PostgreSQL, a Node.js ingestion daemon can reconnect after outages and resume replay exactly from where it paused.

// nodejs-pubsub-consumer.ts: Resilient-Message-Delivery Salesforce Streaming Bridge
import { PubSubApiClient, ReplayPreset } from '@salesforce/pubsub-api-client';
import { Kafka } from 'kafkajs';

const redis = new Redis(process.env.REDIS_URL); const kafka = new Kafka({ brokers: [process.env.KAFKA_BROKER] }); const producer = kafka.producer();

export async function startCdcBridge() { await producer.connect(); const client = new PubSubApiClient(); await client.init();

const lastReplayId = await redis.get('salesforce:lead:last_replay_id');

const subscription = await client.subscribe({ topicName: '/data/LeadChangeEvent', replayPreset: lastReplayId ? ReplayPreset.CUSTOM : ReplayPreset.LATEST, replayId: lastReplayId ? Buffer.from(lastReplayId, 'hex') : undefined, });

subscription.on('data', async (event) => { const recordId = event.payload.ChangeEventHeader.recordIds[0]; // Partition by RecordId to guarantee in-order delivery per CRM record await producer.send({ topic: 'salesforce.cdc.leads', messages: [{ key: recordId, value: JSON.stringify(event.payload), headers: { replayId: event.replayId.toString('hex') } }] });

// Persist checkpoint await redis.set('salesforce:lead:last_replay_id', event.replayId.toString('hex')); }); } `

4. Production Blueprint: Apex Event Publishing, Idempotency & Dead Letter Queues

For enterprise resilience, every event consumer must enforce strict idempotency. Because network retries can result in at-least-once delivery, downstream consumers compute a deterministic SHA-256 idempotency key (RecordId + CommitTimestamp + ChangeType) before executing business logic.

Key pillars of our production event architecture include:

  • •Partition Key Alignment: Partitioning Kafka topics by Salesforce RecordId ensures that all updates to a single lead or account execute in strictly chronological sequence across distributed worker squads.
  • •Dead Letter Queues (DLQ): Poison-pill payloads or schema mismatches are diverted to a dedicated DLQ (salesforce.cdc.dlq) with automated Slack alerts, isolating transient failures from halting consumer partitions.
  • •Holistic Ecosystem Synergy: Connecting Salesforce event logs directly with custom Next.js Web Applications and Shopify Storefronts.

To explore how we remediate governor limits and architect enterprise streaming solutions, review our Salesforce API Governor Limits Postmortem, our Inbound Lead Qualification Webhook Guide, or schedule an architectural consultation on our Contact Page.

Senior Engineering Practice

Need architectural guidance on Enterprise CRM?

We partner with founders and engineering leaders to design, build, and optimize scalable web platforms, custom e-commerce engines, and Salesforce CRM ecosystems with 100% intellectual property ownership.

A

Written by Anjali

Senior Technical Architect & SEO Systems Engineer

Anjali is a Senior Technical Architect & SEO Systems Engineer focusing on technical SEO architecture, WCAG accessibility, Shopify OS 2.0 storefronts, and web security hardening.

Contextual Field Notes

Related Enterprise CRM & Architecture Notes

View all engineering notes
Questions & Details

Key Takeaways & FAQs

How to decouple high-throughput enterprise systems from Salesforce governor limits using Change Data Capture (CDC), high-volume Platform Events, and Apache Kafka pub/sub consumers with reliable message delivery.

Direct Engineering Engagement

Have a project in mind? Send us the details and we’ll reply within a day.

We engineer scalable cloud architecture, custom web platforms, and Salesforce CRM systems for growing companies and global enterprises.

1-Day Reply SLADirect senior architect review
Strict Mutual NDA100% IP confidentiality
Full Code OwnershipNo vendor lock-in
Fixed Sprint BillingPredictable milestones