Newer Version Available

This content describes an older version of this product. View Latest

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