EventPublishFailureCallback Interface

Implement this interface to track platform event messages that failed to publish. The onFailure() method in this interface is called when the final result of the asynchronous publish operation becomes available.

EventBus

For more information, see Get the Result of Asynchronous Platform Event Publishing with Apex Publish Callbacks in the Platform Events Developer Guide.

The following are methods for EventPublishFailureCallback.

  • onFailure(result)

    The system invokes this method when the final result of EventBus.publish is available and the publishing of the platform event message failed.

The system invokes this method when the final result of EventBus.publish is available and the publishing of the platform event message failed.

public void onFailure(eventbus.FailureResult result)

Type: void

For an example implementation and a test class, see Get the Result of Asynchronous Platform Event Publishing with Apex Publish Callbacks in the Platform Events Developer Guide.