The Salesforce platform events are addition to other Salesforce integration capabilities such as Outbound Messaging, Apex Callouts and Streaming API. Considering that companies can no longer work solely with one application, this native feature provides an event-driven messaging architecture, enabling apps to communicate inside and outside of Salesforce.
Why Salesforce Platform Events needed ?
End users are interacting with companies through multiple channels like web, mobile, customer care centers, social media and so on. Behind all these channels, there may be multiple systems which are not necessarily in sync for customer data at all times. But customer expects to see correct and same information across multiple channels. This demands real-time sync between various systems to keep customer data up-to-date. Salesforce Platform events capability is based on event-driven messaging architecture which enables Salesforce to send out information to external system when event occurs or consume event published by external system. This capability is beneficial in scenarios where such information sync is required in an application echo system where Salesforce is the key system.
What is Event Driven Archtechture ?
Event-based (message-driven) communication involves event publisher and event consumer. Events are sent regardless of consumer listening or not. Consumers don’t acknowledge it when they receive an event. Event-based communication takes place in near-real time. Key component of event-driven architecture are Event Producer, Event Consumer, Event Channel, Event Message and Event. . The architecture is works well for large distributed systems as it decouples event producers from event consumers, thus simplifying the communication model in connected systems. An event-driven architecture helps in avoidance of point-to-point integration. It offers scalability and avoids tight coupling between systems
Setting Salesforce Platform Events in Salesforce
Platform events enables bi-directional real-time integrations based on events. Salesforce can either act as an event producer or consumer.
Here are examples of business scenarios where platform events can be used:
Salesforce as Event Producer: Salesforce sends out notification to an external order fulfillment app about product shipment order.
Salesforce as Event Consumer: External order fulfillment app sends notification on shipment status for an Order.
Publishing Salesforce Platform Events
To publish event messages, you create an instance of the event and pass it to the EventBus.publish method.
Consuming Salesforce Platform Events
Apex Triggers: You will need to write an after-insert Apex trigger on the event object to subscribe to incoming events.
Process Builder\Flow: To consume platform event though process builder, you will need to create a process that starts when a platform event occurs.
Benefits of Salesforce Platform Events
Customers can run businesses faster on an event-driven architecture
Create a full 360-degree customer experience – real-time integration with any business process
Event-driven workflows to augment data
Can capture and act on millions of streaming events