---
schema_version: "1"
id: 4ebeb91a40388712ecec2fa9819911d635b2399e09c3f744c0319768a4e7fc5c
title: EventBus Namespace
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_namespace_eventbus.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_eventbus.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 35bdb1e876be0efbdfd5572802cb8b6ddf3a0d8bff0305afe1a076bdb80c1bc0
description: The EventBus namespace provides classes and methods for platform events and Change Data Capture events.
---
# EventBus Namespace

The EventBus namespace provides classes and methods for platform events and Change Data Capture events.

The following are the classes in the EventBus namespace.

- **[ChangeEventHeader Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_eventbus_ChangeEventHeader.htm#apex_class_eventbus_ChangeEventHeader)**  
    Contains header fields of Change Data Capture events.
- **[EventPublishFailureCallback Interface](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_eventbus_EventPublishFailureCallback.htm#apex_interface_eventbus_EventPublishFailureCallback)**  
    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.
- **[EventPublishSuccessCallback Interface](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_eventbus_EventPublishSuccessCallback.htm#apex_interface_eventbus_EventPublishSuccessCallback)**  
    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.
- **[FailureResult Interface](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_eventbus_FailureResult.htm#apex_interface_eventbus_FailureResult)**  
    Contains the result of an Apex publish callback when the event publishing failed. This interface is used as a parameter in the onFailure method of the EventPublishFailureCallback interface.
- **[SuccessResult Interface](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.
- **[TestBroker Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_eventbus_TestBroker.htm#apex_class_eventbus_TestBroker)**  
    Contains methods that simulate the successful delivery or failed publishing of platform event or change event messages in an Apex test.
- **[TriggerContext Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_eventbus_TriggerContext.htm#apex_class_eventbus_TriggerContext)**  
    Provides information about the platform event or change event trigger that’s currently executing, such as how many times the trigger was retried due to the EventBus.RetryableException. Also, provides a method to resume trigger executions.

#### See Also

- [_Platform Events Developer Guide_](https://developer.salesforce.com/docs/atlas.en-us.264.0.platform_events.meta/platform_events/platform_events_intro.htm "Platform Events Developer Guide - HTML (New Window)")