Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Get the Result of Asynchronous Platform Event Publishing with Apex Publish Callbacks

Get the final result of an EventBus.publish call through an Apex publish callback that you implement. Without the callback, you can get only the intermediate queueing result in Database.SaveResult of an EventBus.publish call, not the final result.

Event publishing is asynchronous, and the immediate result returned in SaveResult is the result of queuing the publish operation in Salesforce. Sometimes immediate errors are returned, for example, due to a missing required field in the event message. If no immediate errors are returned and when resources become available, the system carries out the queued publish call, and the final result is sent in an Apex publish callback.

Apex publish callbacks are available for high-volume platform events. Legacy standard-volume events aren’t supported.

Note

To walk through the steps of creating and using Apex publish callbacks, see "Get Asynchronous Publish Results with Apex Publish Callbacks" in the Platform Events Debugging Trailhead module.

Note