This applies to Mule 4, Anypoint Studio 7.x
Salesforce Connector Replay Channel can subscribe to Salesforce Change Data Capture, in order to receive any data change on Salesforce. For example, Account record creation, update, delete, or for any other Salesforce objects. This article explains how to Subscribe to Salesforce Change Data Capture in Mule Application flow.
1. Login to Salesforce. Go to Setup -> Integrations -> Change Data Capture, then select a target Salesforce object. In this example, the target object is Account.
2. Create a Mule application
2-1. Create a component Salesforce Connector Replay Channel, then specify channel name as Streaming channel. In this example, the target object is Account so the value will be “/data/AccountChangeEvent”. For other channel names, please refer Salesforce CDC Developer guide
2-2. Create a logger component to show payload, so that we will see the received message on Console.
Example)
<flow name="ytaoka-salesforce-replaychannelFlow" doc:id="01d0fd5c-f777-4eda-a167-a931ef240f65" > <salesforce:replay-channel streamingChannel="/data/AccountChangeEvent" replayOption="FROM_REPLAY_ID" doc:name="Replay channel" doc:id="c036e7c5-86ed-4904-ae34-185ea42319e9" config-ref="Salesforce_Config" replayId="-1" autoReplay="true"/> <logger level="INFO" doc:name="Logger" doc:id="978f0aad-ab09-4910-bc54-a7c3dcc5935c" message="#[payload]"/> </flow>
3. Login to Salesforce then update any Account record. In this example, update an Account name to "TestName2". You will see something like below in the Console log, which is equivalent to the updated Account record which includes the new name "TestName2".
INFO 2019-11-12 08:17:27,496 [[MuleRuntime].cpuLight.05: [sample].sampleFlow.CPU_LITE @14741f50] [event: xxx]
org.mule.runtime.core.internal.processor.LoggerMessageProcessor: {data={schema=CEjkFTwpfASSecY9UGNoOg,
payload={LastModifiedDate=2019-11-11T23:17:30.000Z, ChangeEventHeader={commitNumber=10743571519745, commitUser=0050o00000XTesxAAD,
sequenceNumber=1, entityName=Account, changeType=UPDATE,
changedFields=[Ljava.lang.Object;@4f738b9d, changeOrigin=com/salesforce/api/soap/47.0;client=SfdcInternalAPI/,
transactionKey=0002463d-1e88-1d80-5638-15c821f06b79, commitTimestamp=1573514251000, recordIds=[Ljava.lang.Object;@6e812151},
Name=TestName2},
event={replayId=1065378}}, channel=/data/AccountChangeEvent}
001116946

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.