? Integration with Platform Events

Shen Yifeng

salesforce enthusiast,sfdc developer, consultant

Integration with Platform Events

(1) Why and what is it?

Back at earlier years, data integration with external systems were mostly via the REST and SOAP APIs. Business process integration was done primarily by making web service calls via Apex in Salesforce. As for the growing need of asynchronous interactions, the requirement for ease to use scalability and challenges for bulfication without the governor limit in real world projects, I think salesforce has been trying new platform techniques long time ago. So, the event-driven architecture is being adoptted as a feature called “Platform Events”by salesforce in recent years. We can look at this article for more details as how the EDA is implemented in salesforce: "How Apache Kafka Inspired Our Platform Events Architecture"

It is clear that intrinsically, events in this EDA architecture are immutable time-ordered log like this:

In salesforce org, platform event message is a custom notification that we can publish and subscribe to. Similar to the producer/consumer concept in Apache Kafka, the platform events running on the Event Bus is based upon publish/subscribe model(no differentce in concept though) for the sake of simplicity and reliability. Platform events create a first-class event-driven publish-subscribe communication architecture on the platform looks like this:

(2) How to use it?

This is my favorite sample provided by salesforce called "Pure Aloe". All the walkthroughs can be referenced in this post: https://developer.salesforce.com/blogs/2017/11/pure-aloe-sample-app-part-2-integration-platform-events.html Third-party apps subscribe to platform events using CometD. I once installed the two on heroku & in my dev org and found the event driven messaging is really fuuny! Please enjoy.

(3) Streaming events comparision

This post which-streaming-event-do-i-use well explained the various streaming events including:

  • Generic event
  • Platform event
  • PushTopic event

With this great architecture, disparate systems could be connected efficiently and concisely in real-time.

References:

Platform event is part of the Salesforce core.

This post is crafted by myself.