Mule with salesforce push topic notification copy
-
Upload
sanjeet-pandey -
Category
Technology
-
view
206 -
download
7
Transcript of Mule with salesforce push topic notification copy
![Page 1: Mule with salesforce push topic notification copy](https://reader035.fdocuments.in/reader035/viewer/2022073118/55aed3a31a28ab785b8b45f8/html5/thumbnails/1.jpg)
www.sanjeetpandey.com
www.sanjeetpandey.com
Prepared by – Sanjeet Pandey
Salesforce Push Topic Notification in Mule
![Page 2: Mule with salesforce push topic notification copy](https://reader035.fdocuments.in/reader035/viewer/2022073118/55aed3a31a28ab785b8b45f8/html5/thumbnails/2.jpg)
www.sanjeetpandey.com
Define Push Topic in SFDC
The easiest way to do this is to either use the workbench at developerforce.com or the developerconsole. I'm going to use the developer console. In the console head to Debug -> ExecuteAnonymous Apex Code. We are essentially creating a SOQL query with a few extra parametersthat watch for changes in a specified object.
If the Push Topic is executed successfully then Salesforce is ready to post notification to MULE ESBif any changes made in the Account object in Salesforce, because the below Push Topic has beencreated for Salesforce’s Account object.
2
![Page 3: Mule with salesforce push topic notification copy](https://reader035.fdocuments.in/reader035/viewer/2022073118/55aed3a31a28ab785b8b45f8/html5/thumbnails/3.jpg)
www.sanjeetpandey.com
Mule SFDC Cloud Connector
Select the MULE SFDC Cloud Connector and setup the following details by defining the Globalelement –
• User Name
• Password
• Security Token
• URL
3
<sfdc:config name="Salesforce"
username="[email protected]"
password="test"
securityToken="DbdkalteklajdcvNJ2vx0
LBHDpYw" url="https://test--
test.cs8.my.salesforce.com/services/
Soap/u/23.0" doc:name="Salesforce"/>
![Page 4: Mule with salesforce push topic notification copy](https://reader035.fdocuments.in/reader035/viewer/2022073118/55aed3a31a28ab785b8b45f8/html5/thumbnails/4.jpg)
www.sanjeetpandey.com
Mule SFDC Inbound Endpoint
To receive the Push Topic notifications from Salesforce, Salesforce connector has to define as ainbound endpoint with the ‘Subscribe topic’ operation by including the Push Topic Name –
4
<sfdc:config name="Salesforce"
username="[email protected]" pass-
word="test" securityTo-
ken="dsggasgLtcvNJ2adsfDpYw"
url="https://test--
test.cs8.my.salesforce.com/services/So
ap/u/23.0" doc:name="Salesforce"/> <flow name="SFDC_TopicFlow1"
doc:name="SFDC_TopicFlow1"> <sfdc:subscribe-topic config-
ref="Salesforce" top-
ic="/pushTopicForAccount"
doc:name="Salesforce (Streaming)"/> <logger message="****** SFDC :
#[payload]" level="INFO"
doc:name="Logger"/> </flow>
![Page 5: Mule with salesforce push topic notification copy](https://reader035.fdocuments.in/reader035/viewer/2022073118/55aed3a31a28ab785b8b45f8/html5/thumbnails/5.jpg)
www.sanjeetpandey.com
Mule flow
Salesforce connector is defined as an inbound endpoint with the ‘Subscribe topic’ operation byincluding the Push Topic Name. In case of any changes in the Salesforce Account object, the PushTopic defined in the Salesforce will auto post the notification to the Mule Connector. Once theAccount changes received in the flow -
5
![Page 6: Mule with salesforce push topic notification copy](https://reader035.fdocuments.in/reader035/viewer/2022073118/55aed3a31a28ab785b8b45f8/html5/thumbnails/6.jpg)
www.sanjeetpandey.com
Outcomes
After deployment of the Mule project, if any changes made against the Account object then it will be notified to Mule using Streaming API.
For example, I have made changes in the Customer details for Last Name from ‘Pandey’ to ‘Pandey1’ –
Once the changes are saved in the Salesforce, this will be notified to Mule via Push Topic -
6
![Page 7: Mule with salesforce push topic notification copy](https://reader035.fdocuments.in/reader035/viewer/2022073118/55aed3a31a28ab785b8b45f8/html5/thumbnails/7.jpg)
www.sanjeetpandey.com 7