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
Select create new platform events
Provide the necessary details
Create custom field in 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
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
It should be defined like – /event/<event name>
Add a log to capture the event payload
Run the project – http://localhost:8081/publishPlatformEvent on browser
Accordingly, we can see the logs
Download the Sample project – http://mulesy.com/wp-content/uploads/2018/12/salesforceplatformeventpoc.zip
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?