Create an Event Relay Configuration
A relay configuration associates the channel in the Salesforce event bus with Amazon EventBridge using the named credential. The creation of the event relay configuration results in a partner event source being created in Amazon EventBridge. The partner event source is created with a pending status.
USER PERMISSIONS NEEDED | |
---|---|
To create an EventRelayConfig: | Customize Application |
To use REST API: | API Enabled |
-
Send a POST request to this URI.
/services/data/v57.0/tooling/sobjects/EventRelayConfig/
-
If you’re using Postman, under Tooling, click Post Tooling SObject, and then replace the
:SOBJECT_API_NAME
placeholder withEventRelayConfig
. -
In this request body, replace the destinationResourceName value with the named credential developer name and with the
callout:
prefix prepended. Also, replace the value for eventChannel with the full name of the event channel that you created earlier, which corresponds to theFullName
field value. For example:MyRelayChannel__chn
. -
Send the request. The response received looks similar to this response.
Save the returned ID value of the new event relay. You use it later.
EventRelayConfig contains additional fields that are optional and that aren’t part of the given example.
- The
state
field specifies the execution state of the event relay. If you don’t specify this field, the event relay is created with a default state of STOP. If you specify this field when creating an event relay, the only valid value you can set is STOP. To manage the state of the event relay, see Manage the Event Relay Execution in Salesforce. - The
relayOption
field specifies an option for resuming event relay after the system recovers from an error if the relay can’t resume after the last relayed event. For more information, see Choose an Event Relay Resumption Option After Error Recovery.
- When you delete an EventRelayConfig through Tooling API, its corresponding partner event source in Amazon EventBridge is deleted. The event bus that is associated with the partner event source in AWS isn’t affected.
- You can’t package EventRelayConfig in a managed package because event relay doesn't support namespaces. Also, the objects that event relay references-the event channel and its members, and the named credential-can't have namespaces. You can package EventRelayConfig in an unmanaged package. If you do so, make sure to also add to the package the named credential that is referenced in the
destinationResourceName
field. The package manager doesn't add it automatically.
The event relay is created in a stopped state, and no events are relayed to Amazon EventBridge. Before starting the event relay, activate the partner event source in Amazon EventBridge. You perform these steps next.
See Also
- Tooling API Developer Guide: EventRelayConfig
- Metadata API Developer Guide: EventRelayConfig