Publish and Consume Salesforce Event

 

Let’s see how we can Publish and Consume Salesforce Event from MuleSoft.

Create Platform Event on Salesforce

Go to Integration and then select Platform Events

Publish and Consume Salesforce Event

 

Select create new platform events

Publish and Consume Salesforce Event

 

Provide the necessary details

Publish and Consume Salesforce Event

 

Create custom field in Event

Publish and Consume Salesforce Event

 

Provide the necessary details for custom events

 

Last we can see the Event we have created

 

In MuleSoft, create a Saleforce connector

Provide the username, password and security token

Publish and Consume Salesforce Event

 

Test the connection

 

First we create a Publish Event flow to create a new event

 

Add the transformation which will create a Event payload

 

Event dropdown will be prepopulated and we can select the appropriate event

 

Transform the received payload from Saleforce connector

 

Add a logger to capture the response

 

Accordingly lets create a Subscriber flow which will listen to Event and log it

Subscribe to event

Publish and Consume Salesforce Event

 

It should be defined like – /event/<event name>

Add a log to capture the event payload

Publish and Consume Salesforce Event

 

Run the project – http://localhost:8081/publishPlatformEvent on browser

Publish and Consume Salesforce Event

 

Accordingly, we can see the logs

Publish and Consume Salesforce Event

 

Download the Sample project – http://mulesy.com/wp-content/uploads/2018/12/salesforceplatformeventpoc.zip

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Raj
Raj
5 years ago

How do you reprocess the failed messages. Ex: if replay id’s 10,18,26 have failed. How do you capture these id’s and reprocess the 3 failed messages?