Newer Version Available

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

Subscribe to Change Events

You subscribe to change events the same way you subscribe to other events, like PushTopic events or platform events. You can use CometD or Apex triggers. CometD is a messaging library that enables listening to events through long polling and simulates push technology. Apex triggers for change events are similar to Apex triggers on platform events.

The Event Bus

Change events are based on platform events and share some of their characteristics. Change event messages are published to the event bus, where they are stored temporarily for three days. You can retrieve stored event messages from the event bus. Each event message contains the ReplayId field, which identifies the event in the stream and enables replaying the stream after a specific event. For more information, see Message Durability in the Streaming API Developer Guide.

Order of Events

Salesforce sends change event messages to subscribers through the event bus sequentially in the order that they’re received. The order of event messages is based on the event replay ID.

User Permissions Required

The subscriber must have one or more of the following permissions depending on the subscription channel: View All Data, View All Users, and View All for an object. See Required Permissions for Subscription.