Platform Event Bus
The Platform Event Bus is the Salesforce-managed publish-subscribe infrastructure that delivers Platform Events, Change Data Capture events, and Streaming API messages between publishers and subscribers.
Definition
The Platform Event Bus is the Salesforce-managed publish-subscribe infrastructure that delivers Platform Events, Change Data Capture events, and Streaming API messages between publishers and subscribers. It is the event-streaming backbone of the modern Salesforce integration architecture, abstracting message routing, retry behaviour, replay, and durability away from the integrations that use it. Publishers fire events; the Event Bus broadcasts them to every subscriber registered for that event type, without point-to-point coupling between systems.
Underneath, the Event Bus runs on Salesforce's distributed message infrastructure (built on Apache Kafka). Events are durable for 72 hours (or longer for High-Volume Platform Events with the right license tier), can be replayed by subscribers using a replay ID, and support multiple concurrent subscribers per event type. The bus is what makes Platform Events scalable to high-volume use cases that would crush a synchronous integration pattern, and what gives Change Data Capture its 72-hour catch-up window for offline subscribers.
How the Platform Event Bus delivers events between Salesforce publishers and subscribers at scale
Three event types and what each carries
The Event Bus handles three event categories. Platform Events are custom event definitions admins create (Order_Shipped__e, Customer_Onboarded__e); the publisher includes whatever fields the event needs. Change Data Capture events fire automatically when records change on CDC-enabled objects (Account, Case, custom); the payload is the changed fields. PushTopic and Generic Streaming events are the legacy patterns, still supported for backward compatibility but feature-frozen. Each type lives on the same bus infrastructure with different schema and routing rules.
Durability and the 72-hour replay window
Events persist on the bus for 72 hours by default. Subscribers can subscribe in real time and receive events as they fire, or subscribe with a replay ID to catch up on missed events from up to 72 hours ago. The replay ID is a numeric sequence per event type; the subscriber tracks the highest replay ID it has processed and resumes from there after disconnects. This is what makes the bus resilient to subscriber outages; a subscriber that goes offline for two hours can replay every event it missed without coordination with publishers.
Publishing patterns: Apex, Flow, REST, External
Four ways to publish events. EventBus.publish() in Apex publishes one or many events from server-side code, returning save results. Flow has a Publish Platform Event action that publishes without code. The REST API endpoint /services/data/vXX.X/sobjects/<eventName>/ publishes from external systems. Outbound integrations that need to fire events into Salesforce often use the REST path. Each method respects the same governor limits (DML rows, async limits) as a normal record insert because Platform Events are insert-based under the hood.
Subscribing patterns: Apex Trigger, Flow, External CometD
Three ways to subscribe. Apex Triggers on the event object fire when events publish, handling the event server-side inside Salesforce. Flow''s Platform Event-Triggered Flow runs when events publish, allowing declarative handlers. External systems use the CometD protocol (a Bayeux pub-sub over long-polling HTTP) to consume events. Modern external subscribers also use the Pub/Sub API, a gRPC-based replacement for CometD launched in 2022 that supports binary serialization and better scaling.
High-Volume Platform Events versus Standard
Salesforce ships two tiers. Standard Platform Events have lower volume caps and shorter retention. High-Volume Platform Events support higher throughput (millions of events per day depending on license), longer retention (up to 7 days), and tighter SLAs. High-Volume is a separate license tier; most orgs default to Standard until volume justifies the upgrade. Mixing tiers within one org is supported; each event definition picks its tier at creation.
Governor limits and the daily event allocation
The Event Bus is subject to per-org daily event allocations. Standard Salesforce orgs receive a baseline event allocation; higher tiers allocate more. Both publish and delivery count against the allocation: publishing 1000 events delivered to 5 subscribers can consume 6000 events worth of allocation (1000 publish + 5000 delivery). Watch the org''s Event Monitoring usage if event volume is non-trivial; exceeding the allocation throttles further publishes.
Pub/Sub API and the modern subscriber experience
The Pub/Sub API is the gRPC-based modern subscriber protocol, launched in 2022 to replace CometD for external subscribers. It supports binary protobuf serialization (smaller, faster), bidirectional streaming (subscribers can both publish and subscribe on the same connection), and richer error semantics. External integrations building new event subscribers should default to Pub/Sub API; CometD is still supported but feature-frozen. The Pub/Sub API has Salesforce-published client libraries for Java, Python, Node.js, and Go.
Designing event-driven integration on the Platform Event Bus
The Event Bus is not configured directly. Configuration happens at the event-type level (define a Platform Event, enable CDC on an object) and at the subscriber level (Apex trigger, flow, external Pub/Sub client). The design pattern below covers the recommended approach.
- Define the event
For Platform Events: Setup, Platform Events, New Platform Event. Set name, API name, publish behaviour (Publish Immediately or Publish After Commit). Add custom fields representing the event payload. For CDC: Setup, Change Data Capture, enable on the desired standard or custom objects.
- Wire the publisher
Apex: EventBus.publish(new MyEvent__e(Field1__c = value)). Flow: Action element, Publish Platform Event. External: POST to /services/data/vXX.X/sobjects/MyEvent__e/. Pick the path matching the publisher''s context.
- Wire the subscriber
Apex Trigger: trigger MyEventTrigger on MyEvent__e (after insert). Flow: Platform Event-Triggered Flow on the event type. External: Pub/Sub API client connecting via gRPC with appropriate auth.
- Test end-to-end
Publish an event in sandbox. Verify every subscriber fires. Check Event Monitoring for the publish and delivery records. Test the failure path: simulate a subscriber outage and replay events using the replay ID.
- Monitor in production
Setup, Event Monitoring, look at daily event counts and delivery success rates. Build alerts on event allocation usage; surprise spikes mean either traffic growth or a runaway publisher.
Standard Platform Events (baseline allocation, 72-hour retention) or High-Volume (extended allocation, up to 7-day retention, separate license).
Publish Immediately (event delivers as soon as the publish call returns) or Publish After Commit (event waits for the surrounding database transaction to commit).
Apex Trigger, Flow, Pub/Sub API (gRPC, modern), CometD (legacy, feature-frozen). Pick based on subscriber location and language.
Subscribers can replay from any event in the retention window using a replay ID, or skip ahead to live events. Track replay ID on the subscriber side to handle restarts gracefully.
- Events persist for 72 hours on Standard tier. Subscribers offline longer than that lose events; build a separate catch-up mechanism for long outages.
- Daily event allocation counts both publish and delivery. A high fan-out event with many subscribers consumes the allocation faster than the publish count alone suggests.
- Publish After Commit waits for the transaction to commit. Publish Immediately fires even if the transaction later rolls back, producing phantom events. Pick carefully.
- Pub/Sub API is the modern subscriber path. CometD still works but is feature-frozen; new external integrations should use Pub/Sub.
- Apex triggers on Platform Events run async, in a separate transaction from the publish. Errors in the trigger do not roll back the publish.
Trust & references
Cross-checked against the following references.
- Platform Events Developer GuideSalesforce Developer Docs
Straight from the source - Salesforce's reference material on Platform Event Bus.
- Define a Platform EventSalesforce Help
- Change Data Capture Developer GuideSalesforce Developer Docs
Hands-on resources to go deeper on Platform Event Bus.
About the Author
Dipojjal Chakrabarti is a B2C Solution Architect with 29 Salesforce certifications and over 13 years in the Salesforce ecosystem. He runs salesforcedictionary.com to help admins, developers, architects, and cert/interview candidates sharpen their fundamentals. More about Dipojjal.
Test your knowledge
Q1. What is the Platform Event Bus?
Q2. What protocols does it support?
Q3. What's a key feature?
Discussion
Loading discussion…