How do event-driven data replication patterns streamline data warehousing and analytical data lake synchronization?
Answer
Basics: Traditional replication runs scheduled bulk queries and compares timestamps, which is slow and consumes API calls. With CDC, Salesforce publishes a change event whenever selected objects are created, updated, deleted or undeleted. A subscriber applies those changes to a warehouse such as Snowflake, BigQuery or a lake.
How it works:
- Select objects in Setup > Change Data Capture. The number of entities included free is limited (verify, extra entities need an add-on).
- Do an initial full load with Bulk API (use PK chunking for big tables).
- Subscribe to
/data/AccountChangeEventthrough Pub/Sub API (or CometD). - Each event carries
ChangeEventHeaderwithchangeType,changedFields,recordIds,commitTimestamp,transactionKeyandsequenceNumber. - A consumer writes events to a stream such as Kafka and merges them into target tables, storing the last replay ID.
- On
GAP_*orGAP_OVERFLOWevents, or if the replay ID has expired, resync the affected records.
Advanced / deep dive: Retention is about 72 hours, so a consumer outage longer than that needs a full or incremental reload. Events are field-level for updates, so apply them as upserts keyed on the Salesforce ID. Handle deletes as tombstones or soft deletes in the warehouse. CDC delivers committed changes, honours field-level security of the subscriber, and does not include formulas. Alternatives include Salesforce Data Cloud (rebranded Data 360 in recent releases, verify) zero-copy sharing with Snowflake or BigQuery, Heroku Connect, and ETL tools using Bulk API 2.0 queries. Pick CDC when freshness matters more than simplicity.