Newer Version Available

This content describes an older version of this product. View Latest

Enterprise Messaging Platform Events

The Salesforce enterprise messaging platform is event-based and offers the benefits of event-driven software architectures. Platform events are the event messages (or notifications) that your apps send and receive to take further actions. Platform events simplify the process of communicating changes and responding to them without writing complex logic. Publishers and subscribers communicate with each other through events. Multiple subscribers can listen to the same event and carry out different actions.

You can customize the schema of platform events to define which data types to send in a message.

You can publish and consume platform events by using Apex or an API. Platform events integrate with the Salesforce platform through Apex triggers. Triggers are the event consumers on the Salesforce platform that listen to event messages. Whether an external app through the API or a native Force.com app through Apex published the event message, a trigger on that event gets fired. Triggers run the actions in response to the event notifications.

For example, a software system monitoring a printer makes an API call to publish a custom event when the ink is low. The printer event message contains custom fields for the printer model, serial number, and ink level. After the printer sends the event message, an Apex trigger is fired in Salesforce. The trigger creates a Case record to place an order for a new cartridge.

As an alternative to using Apex triggers, external apps can listen to event notifications by subscribing to a channel through CometD.