Change Data Capture is a product on the Lightning Platform that enables us to integrate Salesforce data with external systems. With Change Data Capture, we can receive changes of Salesforce records in real time and synchronize corresponding records in an external data store. Change Data Capture publishes events for changes in Salesforce records corresponding to create, update, delete, and undelete operations.
Use Change Data Capture to update data in an external system instead of doing periodic exports or API polling. Capturing changes with Change Data Capture event notifications ensures that your external data can be updated in real time and stays fresh.
When to Use Change Data Capture
- Need to create data replication process for the cloud between two system
- Receive notifications of Salesforce record changes, including create, update, delete, and undelete operations.
- Capture all field changes for all records.
- Get information about the change in the event header, such as the origin of the change, so you can ignore changes that your client generates.
- Perform data updates using transaction boundaries when more than one operation is part of the same transaction.
Use a versioned event schema.
- Subscribe to mass changes in a scalable way.
- Get access to retained events for up to five days.
What Are Streaming Events and Why Use Them?
Change Data Capture requires an integration app for receiving events and performing updates in the external system.
Streaming events are instant notification messages that one system (the publisher) sends to another (the subscriber). With push technology, the publisher pushes data to the subscriber. This is the opposite of pull technology. With pull technology, clients request data from the server periodically. When you connect systems through pull technology, clients poll the server for data updates, and freshness of data depends on the poll frequency. In addition, clients can make excessive calls and cause server slowdown.
Using the publisher/subscriber model and push technology, Change Data Capture sends notifications to subscribers whenever a data change in Salesforce occurs. Notification messages are sent to the event bus to which clients can subscribe through a channel. Event-driven systems streamline the communication between distributed enterprise systems, increase scalability, and deliver real-time data.
An Example Integration App
Jane Doew is a software developer at Vagmine Cloud Solution, a high-tech consulting firm specializing in CRM implementations. Jane is developing an Pharma synchronization app for a client. The app synchronizes Salesforce record data changes with an HR system that’s external to Salesforce. Jane’s consulting client creates and modifies some of its employee in Salesforce as Employee__c custom object records. The client wants the employee data in the HR system to be in sync with Salesforce.
Jane’s integration app has the following requirements.
- Replicate every new or changed employee (Employee__c) custom object record in the HR data store.
- Replicate all employees records along with all their fields.
- Use transaction-based replication. If multiple updates are in a single transaction, the integration app sends these updates as part of one transaction.
- Resume the replication from past event notifications that are stored for up to three days if the data replication process fails.
After Change data capture integration jane subscribes his app to the channel for the Employee custom object, the app receives notifications for every change with all modified fields