The following are methods for EventBus. All methods are static.
public static String getOperationId(Object result)
Type: String
public static Database.SaveResult publish(SObject event)
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 published for a standard-volume event. For a high-volume event, the publish request is queued in Salesforce and the event message might not be published immediately. For more information, see High-Volume Platform Event Persistence. If isSuccess() returns false, the event publish operation resulted in errors, which are returned in the Database.Error object. This method doesn’t throw an exception due to an unsuccessful publish operation.
Database.SaveResult also contains the Id system field. The Id field value is not included in the event message delivered to subscribers. It is not used to identify an event message, and is not always unique.
public static List<Database.SaveResult> publish(List<SObject> events)
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 published for a standard-volume event. For a high-volume event, the publish request is queued in Salesforce and the event message might not be published immediately. For more information, see High-Volume Platform Event Persistence. If isSuccess() returns false, the event publish operation resulted in errors which are returned in the Database.Error object. EventBus.publish() can publish some passed-in events, even when other events can’t be published due to errors. The EventBus.publish() method doesn’t throw exceptions caused by an unsuccessful publish operation. It is similar in behavior to the Apex Database.insert method when called with the partial success option.
Database.SaveResult also contains the Id system field. The Id field value is not included in the event message delivered to subscribers. It is not used to identify an event message, and is not always unique.