---
schema_version: "1"
id: 3264265b061a65574e1596fc807ee405b37931587b4877c58501bbc6f5b4264d
title: EventPublishSuccessCallback Interface
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_interface_eventbus_EventPublishSuccessCallback.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_eventbus_EventPublishSuccessCallback.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 45b6b6abffe1b82a93730d093dcb67d19f255287dc28dab37552589a282fe219
description: Implement this interface to track platform event messages that were published successfully. The onSuccess() method in this interface is called when the final result of the asynchronous publish operation becomes available.The system invokes this method when the final result of EventBus.publish is available and the publishing of the platform event message succeeded.
---
# EventPublishSuccessCallback Interface

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

## Namespace

[EventBus](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_eventbus.htm "The EventBus namespace provides classes and methods for platform events and Change Data Capture events.")

## Usage

For more information, see [Get the Result of Asynchronous Platform Event Publishing with Apex Publish Callbacks](https://developer.salesforce.com/docs/atlas.en-us.264.0.platform_events.meta/platform_events/platform_events_publish_callbacks.htm) in the Platform Events Developer Guide.

- **[EventPublishSuccessCallback Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_eventbus_EventPublishSuccessCallback.htm#apex_eventbus_EventPublishSuccessCallback_methods)**
- **[EventPublishSuccessCallback Example Implementation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_eventbus_EventPublishSuccessCallback.htm#apex_interface_eventbus_EventPublishSuccessCallback_Example)**

## EventPublishSuccessCallback Methods

The following are methods for EventPublishSuccessCallback.

- **[onSuccess(result)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_eventbus_EventPublishSuccessCallback.htm#apex_eventbus_EventPublishSuccessCallback_onSuccess)**  
    The system invokes this method when the final result of EventBus.publish is available and the publishing of the platform event message succeeded.

### onSuccess(result)

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

#### Signature

public void onSuccess(eventbus.SuccessResult result)

#### Parameters

- **result**:
    
    Type: [EventBus.SuccessResult](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_eventbus_SuccessResult.htm#apex_interface_eventbus_SuccessResult "Contains the result of an Apex publish callback when the event publishing succeeded. This interface is used as a parameter in the onSuccess method of the EventPublishSuccessCallback interface.")
    
    The final result of EventBus.publish.

#### Return Value

Type: void

## EventPublishSuccessCallback Example Implementation

For an example implementation and a test class, see [Get the Result of Asynchronous Platform Event Publishing with Apex Publish Callbacks](https://developer.salesforce.com/docs/atlas.en-us.264.0.platform_events.meta/platform_events/platform_events_publish_callbacks.htm) in the Platform Events Developer Guide.