Salesforce Inbound Endpoint CDC (Change Data Capture) Example¶
About Change Data Capture (CDC)¶
Change Data Capture (CDC) in Salesforce allows you to receive real-time changes of Salesforce records, including record creation, updates, deletions, and undeletions. Unlike PushTopics, CDC supports a broader set of standard and custom objects, and it's more scalable and recommended for enterprise-grade integrations.
CDC events are published to event channels in the format: /data/<ObjectName>ChangeEvent
. These events can be consumed by WSO2 Micro Integrator through a Salesforce Inbound Endpoint.
What you'll build¶
This guide shows how to configure a Salesforce Inbound Endpoint using CDC to listen to real-time changes in the Account object.
You will:
- Enable CDC for a Salesforce object.
- Reset the security token to authenticate with the Salesforce API.
- Configure the Inbound Endpoint in WSO2 Micro Integrator using the Visual Studio Code extension.
- Run and test the integration to receive real-time events.
The inbound endpoint captures CDC events and injects them into a mediation sequence. In this example, we simply log the message, but you can extend it with any logic using WSO2 Micro Integrator mediators.
Step 1: Enable CDC for the Account Object¶
-
Login to your Salesforce Account. On the Home page, click the Setup icon (top right).
-
In the Quick Find box, search for
Change Data Capture
. -
Click Change Data Capture under the Integrations section.
-
Select the Account object (or any other object you'd like to track) and click Save.
This enables the publication of AccountChangeEvent events.
Step 2: Reset Security Token¶
-
Login to Salesforce. Click the User Settings icon → Settings.
-
Navigate to Reset My Security Token and click Reset Security Token.
You’ll receive the token via email.
Step 3: Configure Salesforce Inbound Endpoint (CDC) in VS Code¶
-
Follow Create Integration Project to create your integration project.
-
Under Add Artifact, choose Event Integration.
-
Select Salesforce Inbound Endpoint.
-
Use the following configuration:
- Name: SalesforceCDCInboundEP
- Injecting Sequence Name: test
- Error Sequence Name: test
- Polling Interval: 100
- Salesforce Object:
/data/AccountChangeEvent
- Package Version: 45.0
- User Name:
<USERNAME>
- Password:
<PASSWORD><SECURITY_TOKEN>
- Login Endpoint:
https://login.salesforce.com
- SOAP API Version:
45.0
- Wait Time:
5000
- Connection Timeout:
20000
- Execute sequentially and Coordination: select
- Replay: deselect
- Event ID File Path:
<FILE_PATH>
-
Add a Log Mediator to print the incoming CDC event:
-
Add a Drop Mediator to discard the message after logging:
Step 4: Deploy, Run and Test the Integration¶
Run the Integration¶
Build and run the integration using the Deploy Artifacts Guide or simply click the Run button in VS Code extension to run the integration.
Test the CDC Event Flow¶
Go to your Salesforce account and Go to the Accounts tab.
Select any account and click on edit to update the account details.
Expected Output¶
After updating an account, you should see logs like the following in the Micro Integrator console:
To: , MessageID: urn:uuid:56B8EFA309A76212999999737229929, Direction: request, Payload: {"event":{"replayId":6,"createdDate":"2024-12-01T14:21:45.458Z"},"payload":{"ChangeEventHeader":{"entityName":"Account","changeType":"UPDATE"},"Name":"Updated Account","Id":"0012x000005Xc9ZAAS"}}