EventBusSubscriber

Represents a trigger, process, or flow that is subscribed to a platform event.

Supported Calls

query()

Special Access Rules

EventBusSubscriber is read only and can only be queried.

Fields

Field Details
ExternalId
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The ID of the subscriber. For example, the trigger ID.
LastError
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The error message that the EventBus.RetryableException that the trigger has last thrown contains. This field applies to Apex triggers only. Available in API version 43.0 and later.
Name
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The name of the subscribed item, such as the trigger name. If the subscribed item’s name is “Process”, at least one process or flow Wait element is subscribed to the event.
Position
Type
int
Properties
Filter, Group, Nillable, Sort
Description
The replay ID of the last event that the subscriber processed.
Retries
Type
int
Properties
Filter, Group, Nillable, Sort
Description
The number of times the trigger was retried due to throwing the EventBus.RetryableException. This field applies to Apex triggers only. Available in API version 43.0 and later.
Status
Type
picklist
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
Indicates the status of the subscriber. Can be one of the following values:
  • 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.
Tip
Type
int
Properties
Filter, Group, Nillable, Sort
Description
The replay ID of the last published event.
Topic
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The name of the subscription channel that corresponds to a platform event. The topic name is the event name appended with __e, such as MyEvent__e. The topic is the channel that the subscriber is subscribed to.
Type
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The subscriber type (ApexTrigger). If the subscriber is a process or flow Wait element, the type is blank.

Usage

Use EventBusSubscriber to query details about subscribers to a platform event. You can get all subscribers for a particular event by filtering on the Topic field, as follows.

SELECT ExternalId, Name, Position, Status, Tip, Type
FROM EventBusSubscriber
WHERE Topic='Low_Ink__e'