Platform Events
Platform Events
Integration from Salesforce to External client
Publishing:
1. Create a record in platform event object ( newPEvent__e) using the following:
a. Process (Process Builder)
b. Flows
c. Apex
i. Ex:
newPEvent__e ne = new Low_Ink__e(field__c='XZO-5');
EventBus.publish(ne);
Subscribe:
1. External system subscribes, and listens to the latest event records.
a. Use CometD to subscribe to platform events.
b. We can also use EMP Connector
Integration from External client to Salesforce
Publishing:
1. Create a record in platform event object ( newPEvent__e) using api from any of the external client.
d. APIs
i. Ex:
ii. Use /services/data/v46.0/sobjects/newPEvent__e/ endpoint
iii. Request body
{
" field__c " : "something"
}
Subscribe:
2. Salesforce subscribes, and listens to the latest event records.
a. Process.
b. Flows
c. Triggers
d. Lightning Components
Helpful docs I got online: