What is the difference between Change Data Capture (CDC) and Platform Events?
Suggested answer
Platform Events are custom event messages published by your code. You define the schema and decide when to publish. They are best for application-level events and decoupling services.
Change Data Capture (CDC) automatically generates change events whenever a Salesforce record is created, updated, deleted, or undeleted — without any custom code. CDC events contain:
- Enriched fields: The changed fields and their new values, plus header metadata (changeType: CREATE/UPDATE/DELETE/UNDELETE, changedFields bitmap, recordId, commitTimestamp).
- Gap Events: When the CDC subscriber has been offline, Salesforce may issue a gap event indicating missed events, so the subscriber knows to do a full re-sync for affected records.
Key difference: CDC is declarative and Salesforce-generated (enabled per object in Setup); Platform Events are custom and code-driven. CDC is ideal for replicating Salesforce data to external systems; Platform Events are ideal for custom integration workflows.
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.