SalesforceSummaries: a series delivering key insights from Salesforce YouTube videos, to save you time as you keep up to date with the latest technological changes within the Salesforce ecosystem.
Platform Events is a new development paradigm that facilitates modular components and reduces dependencies in complex systems.
Presenter: Florian Hoehn
Time: 17 minutes
Key Terms: Salesforce DX, Platform Events, enterprise level development
[email protected] — Salesforce has grown from a CRM application to an enterprise level platform.
[email protected] — The Salesforce ‘Web2Lead’ feature process and system architecture looked like this:
This is relatively straight forward. A lead is created, gets assigned and eventually conversion to other objects happens.
[email protected] — However, the use of Salesforce within companies expanded and so the demand for the Web2Lead process to have more functionality was met. For example, the Web2Lead process can now work with an Order Management process. Consequently, as per the diagram below, the system architecture got more complicated.
[email protected] — Now, an integration layer is required so as to integrate Salesforce with external systems. For example, a Master Data Management (MDM) system is integrated to ensure high levels of data quality for customer information, a Shipping System is integrated to ensure that the products get shipped correctly, and a payment system is integrated so as to ensure the payment is received prior to sending out the order. This level of complexity goes on and on and on.
[email protected] — And in the example below, this can keep expanding to the point where it becomes increasingly difficult to manage and maintain.
[email protected] — The big issue with all of this is that this is not scalable. For every feature that gets added, the system architecture becomes increasingly complicated. This creates a scenario in which you need to understand every aspect of the system due to the increasing levels of dependencies. Just to be able to understand all the aspects of the system becomes harder and harder and frankly, not sustainable.
[email protected] — So the big question becomes ‘how do we make this scalable?’
[email protected] — The resolution is to leverage Platform Events. Creating Platform Events look and feels like creating an sObject. One of the biggest differences though is these are immutable — they cannot be changed.
Platform Events open up an ‘event driven architecture’ to Salesforce developers. An event producer creates an event and that gets added onto the event bus. The event bus is a queue — it has a strict chronological order and executes each event on it one after the other.
Event consumers subscribe to an event and the moment that event gets put onto the event bus, the event consumer gets notified. This way, the event consumer doesn’t need to know about the event producer rather, just needs to know about the event record. This approach abstracts the dependencies.
[email protected] — This is how Platform Events look like on the force.com platform:
We can publish events (event producers) in a number of different ways, both declaratively and code. These events then get put onto the event bus.
Event consumers consist of processes, flows, apex and CometD (which is via the Streaming API). So the event consumers only need to know about the event bus and not the event producers.
[email protected] — The order management module from the previous system architecture diagram is below:
And the important thing we want to know here is whenever an order record has been created.
So our order management module can be re-architected like so with Platform Events:
[email protected] — Integrations, in particular, can be re-architected far more simply. Platform Events make integrations much easier.
[email protected] — Another use case, this time 100% on the force.com platform, can be seen below. This increases the modularity and reduces dependencies.
[email protected] — The future for Platform Events is very exciting because of all the opportunities that it offers. What if Salesforce standard events can also be subscribed to? And furthermore, what if we have an Event Sourced Platform? This is basically Git. This could be a really powerful future tool using platform events.
[email protected] — Platform Events really play well with Salesforce DX. Salesforce DX wants us to create small code bases that we can handle and deploy easily.
[email protected] — Platform Events is an attribute of enterprise level development and Salesforce is getting there (it’s continuing to become more of an enterprise level platform and not merely just CRM).