Newer Version Available
EventBus Class
Namespace
System
Usage
To learn how to use platform events in Apex, see Publish Platform Events.
EventBus Methods
The following are methods for EventBus. All methods are static.
publish(event)
Publishes the given platform event. To receive published events, use
triggers for the corresponding event object.
Signature
public static Database.SaveResult publish(SObject event)
Parameters
- event
- Type: SObject
- An instance of a platform event. You must define your platform event object first in your org. For example, the type of the platform event object can be MyEvent__e.
Return Value
Type: Database.SaveResult
The result of publishing the given event.
Usage
publish(events)
Publishes the given list of platform events. To receive published
events, use triggers for the corresponding event object.
Signature
public static List<Database.SaveResult> publish(List<SObject> events)
Parameters
- events
- Type: List<sObject>
- A list of platform event instances. You must define your platform event object first in your org. For example, the type of the platform event object can be MyEvent__e.
Return Value
Type: List<Database.SaveResult>
A list of results, each corresponding to the result of publishing one event.