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. One of the ways to consume events off-platform is to use the CometD protocol.
It is outside the scope of this book to discuss connecting using CometD in detail; 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, 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 that the event has been consumed, as shown in the following screenshot:
Figure 12.19 – Subscribing...