Nowadays companies no longer work solely with one application, that is where Event Driven Architectures with Platform Events come into play. Platform Events helps to speed up development where generally ‘point-to-point’ integration would slow it down.
From Summer’17 Release we get this native feature which enables integrations in the spirit of event-driven or message-drive consisting of event producers, event consumers and channels.
What are Platform Events?
Built in real time integration patterns in the salesforce platform via messaging / notifications, which can be bi-directional.
The goal is to reduce the number of point-to-point integrations and expand on the existing capabilities of other integration options such as Outbound Messaging, Apex Callouts, and the Streaming API.
There are five main components:
– The Pipe: ability to add events in chronological order
– A Window: period of time
– The Events themselves
– Publishers: internal or external apps that push events into the pipe
– Consumers: can subscribe to events
How do Platform Events Work?
So from set up you can find Platform Events (If enterprise edition or higher) which looks just like a custom object, note the difference at the end of the API name ‘__e’ rather than the ‘__c’ for custom:
But the bigger difference with other records is that events are immutable. What this really means is that once an event has been published you can’t update it or delete or query it but instead you subscribe to a channel to receive events.
That’s the good news! There is no longer need to build a connection which each one of the external systems.
So, breaking it down on a simple flow you would:
– Define a platform event
– Use a trigger to fire
– External app is to subscribe to the channel’s event
– Salesforce to listen to update what triggered your event
Considering all this, I can only imagine how this feature must have been a challenge to accomplish in Salesforce Multi-tenancy environment.