A Salesforce event relay sends platform events and change data capture events to AWS EventBridge, and to no other target. If your consumer does not read from EventBridge, compare Platform Events and the Pub/Sub API before you build. This page shows how to choose between the three routes and the limits they share.
Start with where the event has to land
Before you open Setup, write down the destination. An event relay is a fixed route. It carries platform events and change data capture events from Salesforce to AWS EventBridge and nothing else. It does not deliver to a queue you run, to a webhook on your own server, or to another Salesforce org. If the consumer already reads from EventBridge, the relay is a short path. If it does not, the relay is the wrong starting point, however simple the setup looks.
Ask three questions in order. Which system consumes the event? Does that system read from EventBridge? Does the event need to cross an org boundary? A yes to the first question and a no to the second makes the relay a candidate. A yes to the third question means the design needs more than a single org’s event flow, so settle the transport before you choose a route.
Compare the three routes by the role each one plays
The three routes solve different parts of the same problem, so compare them by role rather than by name.
- Event relay: sends platform events and change data capture events to AWS EventBridge. Setup is done in configuration rather than code, and AWS EventBridge is the only target.
- Platform Events: custom messages with a structured payload you define. They are not published automatically when a record changes, so an Apex trigger or a Flow has to publish them.
- Pub/Sub API: the subscription interface for platform events, change data capture events, and real-time event monitoring events. It is a pro-code tool, and it is the route for a subscriber your team writes and runs.
The relay moves events out to one fixed target. Platform Events are the messages you publish. The Pub/Sub API is how a subscriber you build reads them. A design can combine roles, such as a Platform Event published from a Flow and read through the Pub/Sub API, but each role needs its own justification.
Check the limits that apply to every route
Events on these routes are kept for replay only within a fixed window, and each message has a maximum payload size. A subscriber that is offline for longer than the replay window cannot count on the stream to fill the gap, so the recovery plan has to sit outside the stream. Confirm both values on your release before you size that plan.
The payload cap shapes the message design. A payload that copies a full record tree and its children can reach the cap on a large account. Carry the record identifier and the fields that changed, and let the consumer fetch the rest. Messages stay small, reads stay tied to current data, and the payload does not grow each time someone adds a field to the object.
Platform events also carry event allocation limits. The figures depend on your org, so read the current values from your own org before you estimate volume. Do not reuse a number from another project.
Set publish timing before you write the trigger
Platform Events offer two publish behaviors, and the choice affects data correctness. Publish Immediately sends the event as soon as the publish call runs, so a subscriber can react before the transaction commits. That can cause row locks or race conditions. Publish After Commit holds the event until the transaction commits, so subscribers only see changes that saved.
With Publish Immediately, the event can still go out if the transaction fails after the publish call, and a subscriber may then act on a change that never saved. Calling the publish method before the DML it describes creates the same risk. Place the publish call after the DML, and confirm the publish behavior on each event definition.
Decide where Platform Events fit and where they stop
Platform Events suit near real-time changes when the consumer needs a custom, structured payload. Estimate your peak publish rate before you commit to the design, because volume is what decides whether the design holds.
Platform Events are a poor fit for moving data from one Salesforce org to another. A cross-org flow needs a different transport, and that choice is worth settling before the event design is locked.
A Platform Event can also work as a bare signal. It carries a reference and tells the consumer that something changed, and the consumer then queries Salesforce for the current state. Use that pattern when the payload would otherwise hold sensitive fields, or when the consumer must read the latest value rather than the value at publish time. The cost is one extra read per event.
Ownership matters once an event feeds a process on another platform. See how the Salesforce and ServiceNow boundary is drawn before you assign ownership of any event that crosses that line.
When the Pub/Sub API is the stronger route
Choose the Pub/Sub API when the consumer is a system your team builds and runs, or when it lives outside AWS and cannot read from EventBridge. The subscriber needs developers who can manage its client code, replay handling and error paths. In return, one interface covers platform events, change data capture events and real-time event monitoring events.
Subscribers built on the older Streaming API can move to the Pub/Sub API when that is feasible, and new subscribers should start there. Run old and new subscribers side by side, compare what each one received, and retire the old path only after the counts match over a full business cycle.
A subscriber that runs around the clock needs its own failure plan. Store the replay position it last processed, handle errors message by message, and alert when the subscriber falls behind the stream. Without a stored position, a restart has no clean point to resume from.
Every subscription adds load to the org, so model it alongside your other integrations with the checklist for API call budgets before you commit to the subscriber.
Plan the data the event depends on
An event route moves changes, but the consumer still needs correct records to act on them. If the first load is incomplete or duplicated, every event that follows inherits the problem. Teams that migrate records while they wire up events often find the reconciliation takes longer than the plumbing.
Make the data trusted before the event flow goes live. Reconcile source and target counts, check the key fields the subscriber uses to match records, and confirm that identifiers in the payload resolve to real records. For the groundwork on load, mapping and cutover, see the data migration and integration planning page. Clean any records that hold duplicates or stale values before events start updating them, and use the Salesforce data quality before migration page for that cleanup.
A decision sequence for the build team
Work through these decisions in order. Skipping the first step is a common reason a relay gets built for a consumer that cannot use it.
- Name the consumer and the platform it runs on.
- Confirm whether the consumer reads from AWS EventBridge. If it does, the relay is a candidate. If not, go to step 3.
- Choose Platform Events or the Pub/Sub API by consumer type and org boundary.
- Set the publish behavior on each event and place the publish call after the DML it describes.
- Size each payload against the payload cap and confirm the replay window covers the longest realistic outage.
- Read the allocation limits and API budget from your own org and model peak volume against them.
For help planning this work, see Salesforce implementation.
Questions about event routing and recovery
How do I recover events a consumer missed during an outage?
Plan a reconciliation pass rather than relying on the stream alone. Store the timestamp of the last event the consumer processed, query records changed after that point, and reprocess them. Use the replay window only when the outage fits inside it.
Which event type should a consumer subscribe to first?
Choose the event type that carries the data the consumer needs. A custom payload points to a Platform Event. A stream of changes to records points to change data capture. Write down the reason for the choice so it survives a team change.
What should I confirm about my edition before choosing a route?
Check that the event features you plan to use are available in your org before you commit to a design. Read the allocation figures from your own org rather than from a previous project, and model peak volume against them.
How much custom code does each route require?
The event relay is low-code and its setup happens in configuration. Platform Events run from low-code to pro-code, depending on whether publish logic lives in Flow or in Apex. The Pub/Sub API is pro-code, so the subscriber carries the code, replay handling and error handling. Estimate subscriber effort first, because it is the part most often underestimated.
More in this section
- Salesforce Integration Architecture with Clear Ownership
- Zero-Copy Federation or Replication: A Data Placement Decision Path
- Moving From Streaming API to Pub/Sub API for Event Subscriptions
- Choosing Synchronous, Asynchronous, or Batch Integration Patterns
- Continuation Callouts for Slow External Lookups During a Page Request