Newer Version Available
Obtain Apex Triggers That Subscribe to a Platform Event
- From Setup, enter Platform Events in the Quick Find box, then select Platform Events.
- Click your event’s name.
On the event’s definition page, the Subscriptions related list shows all the active triggers that are subscribed to platform events. The list shows the replay ID of the event that the system last processed and the event last published. Knowing which replay ID was last processed is useful when there is a gap in the events published and processed. For example, if a trigger contains complex logic that causes a delay in processing large batches of incoming events.
Also, the Subscriptions list shows the state of each subscribed trigger. Trigger states can be one of the following.
- Running—The trigger is actively listening to events.
- Idle—The trigger hasn't received events for some time and is not actively listening to events. When new events are sent, the trigger receives the new events after a short delay and switches to the Running state.
- Error—The trigger has been disconnected and stopped receiving published events. A trigger reaches this state when it exceeds the number of maximum retries with the EventBus.RetryableException. Trigger assertion failures and unhandled exceptions don’t cause the Error state. To resume trigger execution, fix the trigger code and save it.
- Suspended—The trigger is disconnected and can’t receive events due to lack of permissions.
- Expired—The trigger’s connection expired. In rare cases, subscriptions can expire if they’re inactive for an extended period of time.
Alternatively, you can obtain the same subscriber information by querying the EventBusSubscriber object. See EventBusSubscriber.