Platform Events are a fantastic new feature that can now be used in your org. Firstly - I want to once again say how good it is to see Salesforce releasing pieces of functionality like this and that in general they appear to be investing more heavily in developer tools in general. Secondly - this feature has got me more excited than many others on the platform for a while because it brings truly enterprise grade messaging capabilities to the platform and has made them unbelievably simply to publish and subscribe to.
Consuming Off Platform
As I dove into the documentation around Platform Events it became very clear how easy it was to consume and create these events on platform, be it in apex, process builder or flow. But for me that is a bit of a given otherwise how else would you use them? I work with a lot of larger enterprise customers who have me conjuring up integrations for them between their different systems and want to find a really quick and easy way to know that their off platform app needs to do something because an event has occurred in Salesforce - well now they can.
/event/YOUR_EVENT_NAME__e in the EMP-Connector and it would do the rest, so I went away and tried it using the wonderful JSForce. So below, is 10 lines of code I ran as a node app, which when I emitted a Demo event from Salesforce logged the event onto my console (as shown in the pic following).
Whoop! Events on my machine!
The event I created was called Demo and had a single text field,
Message__c, so I could send a message across for me to see. For those with a desire to see the Apex code I used in Execute Anonymous to create the events it was:
So there you have it…