Platform Events vs CDC vs PushTopics vs Pub/Sub API: Choosing Your Salesforce Event Channel
"Just use a platform event." "No, use CDC." "Our middleware already listens to a PushTopic." "Shouldn't this be Pub/Sub API?" Every Salesforce integration design meeting gets here eventually. The confusion is real, because these four names aren't four versions of the same thing.
Three of them are kinds of event, meaning what gets published. Pub/Sub API is a way to connect, meaning how an external system publishes and subscribes. Once that clicks, the choice gets much easier. In this post you'll fire real-world scenarios at all four in the Event Bus Simulator, inspect each one's payload, build your own recommendation in the Channel Picker, and finish with an interview-style quiz.
The Event Bus Simulator
Pick something that happens in your org, then press Fire. Watch which channel delivers, which stays silent, and why.
1. The one-minute mental model
| What it is | Who publishes | Status | |
|---|---|---|---|
| Platform Events | Custom messages with a schema you define (Order_Shipped__e) | You: Apex, Flow, or an API | Current |
| Change Data Capture | Automatic messages for record create, update, delete and undelete | Salesforce, on commit | Current |
| PushTopics | Notifications for records matching a SOQL query | Salesforce, when a match changes | Legacy |
| Pub/Sub API | gRPC API to publish and subscribe to platform events and change events | n/a (it's the pipe) | Recommended |
Salesforce is explicit on two points. PushTopic and generic events are legacy products. And for new apps that publish or subscribe to platform events and change events, it recommends Pub/Sub API instead of the CometD-based Streaming API.
2. Platform Events: messages you design
You define a platform event much like a custom object, with an __e suffix and typed fields. Publish it from Apex, Flow or an external API. Subscribe with Apex triggers, platform event–triggered flows, the empApi Lightning component, CometD or Pub/Sub API. Use them for business moments that no single record change captures: "order shipped", "payment failed", "printer low on ink".
// Publish (Apex)
List<Order_Shipped__e> events = new List<Order_Shipped__e>();
events.add(new Order_Shipped__e(Order_Number__c = 'ORD-1042', Carrier__c = 'DHL'));
List<Database.SaveResult> results = EventBus.publish(events); // never throws: check each result
// Subscribe (Apex): platform event triggers are always after insert
trigger OrderShippedSubscriber on Order_Shipped__e (after insert) {
List<Task> tasks = new List<Task>();
for (Order_Shipped__e evt : Trigger.new) {
tasks.add(new Task(Subject = 'Notify customer: ' + evt.Order_Number__c));
}
insert tasks;
}- Publish behavior matters. Publish After Commit waits for the transaction to succeed and rolls back with it. Publish Immediately doesn't respect transaction boundaries, which is what you want for error logging that must survive a rollback. Publish behavior doesn't apply to Pub/Sub API publishing.
- Triggers run on their own. Event triggers run asynchronously in a separate transaction, as the Automated Process user by default, with batches of up to 2,000 messages. Override the user and batch size with
PlatformEventSubscriberConfig. - Deduplicate with EventUuid. To identify a message uniquely, use the
EventUuidfield, notReplayId. - Release note: new event definitions have been high-volume since API version 45.0. Standard-volume custom platform events are scheduled to retire in Summer '27, so migrate any you still have.
Payload Inspector
The same kind of business change, as each channel delivers it. Tap the highlighted fields to see why they matter.
Samples are trimmed for readability. IDs and values are illustrative.
3. Change Data Capture: the record's diary
Select objects on the Change Data Capture page in Setup, and Salesforce publishes a change event whenever a record is created, updated, deleted or undeleted. You write no publishing code. CDC is built for keeping another system in sync. Every event carries a ChangeEventHeader with changeType, changedFields, changeOrigin, and the transactionKey and sequenceNumber you need to replay a whole transaction as one commit downstream.
- Five objects by default. Without an add-on licence you can select up to five entities, counted across all channels.
- Handle gap and overflow events. When Salesforce can't generate a full change event (for example, a change made directly in the database, or an event over 1 MB), it sends a gap event with only the header. Your subscriber should re-read the record by ID.
- Loop protection.
changeOriginshows which API and client made the change, so your integration can skip changes it made itself. - Apex can listen too. Change event triggers (
AccountChangeEvent,Employee__ChangeEvent) are after-insert only and run asynchronously after the change commits. Flows can't subscribe to change events.
4. PushTopics: the original, now legacy
A PushTopic is a SOQL query saved as a channel (/topic/InvoiceStatementUpdates). When a matching record changes, subscribers get a notification. Salesforce no longer adds features to PushTopic events, gives them limited support, and recommends CDC instead. Two gaps catch teams out:
- Bulk API changes are invisible. Changes made through Bulk API, including Data Loader and the Mass Transfer tool, don't generate notifications.
- Cascade deletes are invisible. Records deleted because their parent was deleted don't trigger a notification. CDC does capture them.
PushTopic events are kept for 24 hours (high-volume platform events and change events for 72), and you can only subscribe to them through CometD, not Pub/Sub API.
5. Pub/Sub API: the modern pipe
Pub/Sub API is a single gRPC API, over HTTP/2, to publish events, subscribe to them and fetch their schemas. Payloads are compact binary Apache Avro. It went GA in 2022 and works with any of the 11 languages gRPC officially supports.
- Pull-based flow control. The client asks for N events and asks for more when it's ready, so a slow consumer isn't flooded. Compare that with CometD pushing as fast as events arrive.
- Managed subscriptions (beta). With
ManagedSubscribe, the client commits the last processed Replay ID to Salesforce, and a restarted client resumes from there. You no longer have to store Replay IDs yourself. - What it can't do. It doesn't carry PushTopic or generic events. Moving to Pub/Sub API means moving to platform events or CDC.
- On AWS? Event Relay streams platform events and change events to Amazon EventBridge with no subscriber app to run.
empApi, event relays) share one rolling 24-hour event delivery allocation across platform events and change events: 50,000 in Performance and Unlimited, 25,000 in Enterprise and 10,000 in Developer Edition, without an add-on. It's counted per subscribed client, so two subscribers each receiving 15,000 events use 30,000. Apex triggers and flows don't count against it. Size it before go-live, not after the first disconnect.
The Channel Picker
Answer five questions about your integration. Get the event type, how to consume it, and the settings that matter.
Predict the Outcome
Six scenarios that come up in integration reviews and interviews.
Cheat sheet: side by side
| Platform Events | CDC | PushTopics | |
|---|---|---|---|
| Triggered by | Your code, Flow or API | Record create/update/delete/undelete | Record matching a SOQL query |
| Payload | Fields you define | Header + changed record fields | Fields in the query |
| Retention | 72 hours | 72 hours | 24 hours |
| Apex trigger | Yes (after insert) | Yes (after insert) | No |
| Flow | Publish and subscribe | No | No |
| Pub/Sub API | Publish and subscribe | Subscribe | No (CometD only) |
| Bulk API changes | n/a | Captured | Not captured |
| Best for | Business events, decoupling, inbound signals | Replicating data to other systems | Existing apps only; plan a migration |
Checked against the Platform Events, Change Data Capture, Streaming API and Pub/Sub API developer guides in November 2026. Allocations vary by edition and add-on, so confirm yours in Setup.
Official Resources
Straight from Salesforce: the docs this article is based on.
Trailhead
Developer Docs
- Enterprise Messaging Platform Events Platform Events Developer Guide
- Subscribe with Apex Triggers Platform Events Developer Guide
- ChangeEventHeader Fields Change Data Capture Developer Guide
- Change Data Capture Allocations Change Data Capture Developer Guide
- Streaming Event Features Streaming API Developer Guide
- Get Started with Pub/Sub API Pub/Sub API Developer Guide
Designing an event-driven integration, or retiring PushTopics?
Book a session with our architects to choose channels, size allocations and plan the migration.