EventRelayConfig defines a relay that sends Salesforce platform events and change data capture events to Amazon EventBridge. It connects an event channel to a named credential containing AWS account information and controls whether the relay runs, pauses, or stops, along with its recovery behavior after an error.
The configuration identifies the destination through a Salesforce named credential, not an AWS resource identifier. Its destinationResourceName must contain the named credential's developer name with the callout: prefix, such as callout:MyRelayNamedCredential.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The metadata component name, inherited from Metadata. This is the name used to identify the component in the deployment manifest. |
destinationResourceName |
Required. References the NamedCredential that stores AWS account information. Use its developer name prefixed with callout:, not a Salesforce record ID or an AWS resource identifier. This binding cannot be updated after creation. |
eventChannel |
Required. References a PlatformEventChannel by its full name, such as MyRelayChannel__chn. This binding cannot be updated after creation. |
label |
The relay label displayed in the user interface. It is not one of the fields that can be updated after creation. |
relayOption |
A JSON-encoded string that selects fallback recovery behavior when the relay cannot resume after the last relayed event. Supported options are {"ReplayRecovery":"LATEST"}, the default, and {"ReplayRecovery":"EARLIEST"}. |
state |
The execution state: RUN, PAUSE, or STOP. A new relay must start in STOP. The exposed value DELETE is reserved for future use. |
usageType |
Reserved for future use. Its exposed enumeration does not establish support for destinations or operating modes beyond the documented Amazon EventBridge integration. |
Behavior and Constraints
Creation and activation
A new relay always starts in STOP. If you omit state, Salesforce creates the relay in that state. If you explicitly supply state during creation, STOP is the only valid value. Creating and activating a relay therefore requires two operations: create it stopped, then update its state to RUN.
Only state and relayOption can be updated. The channel and named credential are creation-time bindings: an update cannot repoint an existing relay to another eventChannel or destinationResourceName.
Running, pausing, and stopping
-
RUN: The relay actively sends event messages from Salesforce to Amazon EventBridge. -
PAUSE: The relay sends no events but saves all current relay state information. -
STOP: The relay sends no events and deletes all current relay state information.
PAUSE and STOP are not interchangeable when preserving relay state matters. The deletion of state information on STOP is distinct from deleting the metadata component. Do not use DELETE as a deletion state; that value is reserved for future use.
Recovery after an error
relayOption applies when the relay cannot resume after the last relayed event following an error. It does not define the normal starting point for every resume operation.
-
{"ReplayRecovery":"LATEST"}is the default. The relay starts with newly received events rather than catching up on events missed while it was down. -
{"ReplayRecovery":"EARLIEST"}resends all events retained in the event bus, then relays new events. The event bus retains events for up to three days.
The recovery choice is a tradeoff between skipping missed events and reprocessing retained history. EARLIEST can resend events that were already relayed; it does not limit recovery to events missed during downtime.
Deployment and Retrieval
Deploying or retrieving EventRelayConfig requires the Customize Application permission.
Components use the .eventRelay suffix and reside in the eventRelays folder. For example, eventRelays/Carbon_Comparison_Relay.eventRelay is identified in package.xml by member Carbon_Comparison_Relay under metadata type EventRelayConfig. The type supports the wildcard * in the manifest.
Separate initial deployment from activation: a definition that creates a relay cannot also start it in RUN. After creation, update state to activate it. For an existing relay, only state and relayOption are updateable; changes to the channel, named credential binding, or label are outside the supported update fields.
The referenced names must use their respective Salesforce identities: the channel's full name for eventChannel, and callout: plus the named credential's developer name for destinationResourceName.
Relationships
The relay connects a Salesforce event channel to a named credential holding AWS account information. These are element references; neither field accepts the referenced component's record ID.
References
-
NamedCredential:destinationResourceName, using thecallout:prefix. -
PlatformEventChannel:eventChannel, using the channel's full name.
Reported Issues
-
Retrieval can fail because the client lacks a metadata registry entry. In a 2023 report, retrieval through a manifest or the VS Code Org Browser failed with
Missing metadata type definition in registry for id 'eventrelayconfig'.The accepted answer attributed the failure to missing support in the tooling registry and suggested Workbench for retrieval and deployment. This was a tooling-specific report, not a finding that Salesforce could not retrieve the type, and it does not establish the status of current clients. See the retrieval report and accepted workaround.
Common Questions
Why can't I create an EventRelayConfig with state RUN?
STOP is the only valid explicit state during creation. Omitting state also creates the relay stopped. Activate it with a subsequent update to RUN.
Can I change the event channel or named credential on an existing relay?
No. Only state and relayOption can be updated. eventChannel and destinationResourceName are fixed at creation.
What is the difference between PAUSE and STOP?
Both prevent event delivery. PAUSE preserves all current relay state information, while STOP deletes it.
Does EARLIEST replay only the events missed during an outage?
No. When fallback recovery is needed, EARLIEST resends all events retained in the event bus, including events already relayed, and then relays new events. Retention is up to three days. The default, LATEST, starts with new events instead.
How do I retrieve EventRelayConfig metadata?
Use EventRelayConfig in the package.xml manifest with a component name or *. Retrieved components use the .eventRelay suffix in eventRelays. Retrieval requires Customize Application. A missing metadata registry error has been reported as a client tooling issue.