Newer Version Available
EventBus Class
Namespace
EventBus Methods
The following are methods for EventBus. All methods are static.
publish(event)
Signature
public static Database.SaveResult publish(SObject event)
Parameters
- event
- Type: SObject
- An instance of a platform event. For example, an instance of MyEvent__e. You must first define your platform event object in your org.
Return Value
Type: Database.SaveResult
The result of publishing the given event. Database.SaveResult contains information about whether the operation was successful and the errors encountered. If the isSuccess() method returns true, the event was inserted.
Usage
publish(events)
Signature
public static List<Database.SaveResult> publish(List<SObject> events)
Parameters
- events
- Type: List<sObject>
- A list of platform event instances. For example, a list of MyEvent__e objects. You must first define your platform event object in your org.
Return Value
Type: List<Database.SaveResult>
A list of results, each corresponding to the result of publishing one event. For each event, Database.SaveResult contains information about whether the operation was successful and the errors encountered. If the isSuccess() method returns true, the event was inserted.