Why Event-Driven
Synchronous REST can’t keep up with multi-system integration velocity. Event-driven decouples producers from consumers, scales independently, handles failure better. 2026’s composable architecture assumes event-driven substrate.
REST callouts hit Salesforce’s 100-callout-per-transaction limit and the per-org concurrent-API ceiling. Each synchronous integration adds latency that compounds across services. Event-driven shifts to pull-when-ready: a downstream consumer subscribes once, processes events at its own pace, and replays from a stored offset on failure. The Spring ‘26 release standardized Pub/Sub API as the primary streaming surface and is deprecating the older CometD streaming API in 2027.
The Salesforce Primitives
Platform Events (user-defined events). Change Data Capture (automatic events on record changes). Pub/Sub API (gRPC-based modern subscriber). Real-Time Event Monitoring (security and usage events).
Quick reference. Platform Events: declarative event objects published from Apex, Flow, or REST. Best for domain events (OrderShipped__e, PaymentReceived__e). Change Data Capture (CDC): emits events for INSERT, UPDATE, DELETE, UNDELETE on enabled objects with full or sparse payloads. Pub/Sub API: gRPC streaming with binary Avro payloads, language SDKs in Python, Java, Go, Node. Real-Time Event Monitoring: security telemetry like LoginEvent, ApiAnomalyEvent for SIEM forwarding.
from pubsub_api_client import PubSubApiClient
client = PubSubApiClient(access_token=token, instance_url=url)
for event in client.subscribe('/data/AccountChangeEvent', replay_id=last_offset):
process(event) # commit offset only after success
Common Patterns
CDC events drive downstream syncs to warehouses and operational systems. Platform Events carry domain actions to external systems. Pub/Sub API simplifies subscriber code in modern languages.
Three production patterns. Outbox: write to Salesforce inside a transaction that also publishes a Platform Event, ensuring downstream notification only on commit. Saga orchestration: long-running multi-system processes coordinated by Platform Events with compensating actions on failure. CDC-to-warehouse: subscribe to CDC, fan out to Snowflake or BigQuery via Kafka or Kinesis, materialize a near-real-time replica for analytics. Avoid the antipattern of using CDC as a primary integration trigger for actions that must run exactly once.
Governance
Events aren’t free. Monitor volume, retention, throughput. Set quotas per publisher to prevent runaway event generation. Consumers must be idempotent — Salesforce’s at-least-once semantics mean duplicates happen.
Each Salesforce edition includes a daily Platform Event allocation (typically 250K for Enterprise, more for Performance/Unlimited). Overages cost real money. Monitor with EventBusUsageMetric. Retention is 72 hours for high-volume Platform Events and CDC; subscribers must persist their replay ID and recover within that window or backfill via REST. Build idempotent consumers using the event UUID as a dedupe key in a 7-day TTL store like Redis or DynamoDB.
Common Failure Modes
Subscriber crashes mid-batch and re-reads from the wrong offset, double-processing. Platform Event published outside the parent transaction, leaving downstream and Salesforce out of sync. CDC enabled on a high-churn object (Activity, Task) and burning the daily allocation by 10am. Retention window exceeded during a long outage, requiring full replay from REST.
What to Do This Week
Audit which Salesforce objects have CDC enabled and confirm each has a documented downstream consumer with replay-ID persistence.