A discussion of the CometD protocol and handling events externally
One of the key benefits of the platform event framework is the ability to consume platform events as a subscriber off-platform. To consume platform events, you need to connect and subscribe to an event channel using the CometD protocol.
It is outside the scope of this book to discuss connecting using CometD; however, you can use the streaming tool available through Salesforce Workbench at https://workbench.developerforce.com/streaming.php to subscribe to the channel and see events as an external service. To do this, select the Generic Subscriptions option and enter /event/eventName
in the Subscription box, and then press the Subscribe button.
For example, in the following screenshot, I have subscribed to the UpdateAccount__e
event channel. If you then publish an event using Execute Anonymous, you will see the event consumed as shown in the following screenshot: