Salesforce Pub/Sub API + CDC Filtered Channels: End-to-End Architecture
A filtered CDC channel defines a useful stream. Pub/Sub API is one modern way to consume that stream outside Salesforce.
End-to-End Flow
Salesforce transaction
|
v
Change Data Capture
|
v
Custom CDC channel
(filter + optional enrichment)
|
v
Salesforce event bus
|
v
Pub/Sub API (gRPC / HTTP2, Avro)
|
v
Subscriber
|
+--> checkpoint/replay
+--> idempotency
+--> transformation
+--> downstream processing
Why Pub/Sub API Changes Consumer Design
Salesforce Pub/Sub API uses gRPC over HTTP/2 and delivers binary event messages encoded with Apache Avro.
That is different from treating the stream as ordinary JSON. Schema handling and CDC header decoding are first-class consumer concerns.
CDC Deserialization Semantics
Salesforce documents an important difference from Streaming API/CometD: Pub/Sub CDC events contain record fields including unchanged fields. Unchanged fields can deserialize with empty values.
Use the change-event header information:
changedFields- fields changed by the transaction;nulledFields- fields explicitly set to null;diffFields- fields represented as data diffs where applicable.
Those header fields are bitmap-based in raw Avro and require proper decoding.
Flow Control
Pub/Sub subscriptions are pull-based. Salesforce's quick-start parameters expose the number of events requested in each fetch request, and the documentation describes pull subscription and flow control.
That lets the consumer control demand rather than accepting an unbounded push rate. Your application still needs bounded concurrency and downstream backpressure.
Replay
Salesforce's event bus retains platform and CDC events for 72 hours. Each event has an opaque replay ID that can be used to resume from a position while the event remains retained.
Persist progress only after your processing semantics say an event is safely handled. If you advance a checkpoint before the downstream write succeeds, a crash can create a gap.
Salesforce also documents Managed Event Subscriptions as a Beta capability that can store committed replay progress server-side. Treat Beta status explicitly when evaluating it for production.
Filtered Channels Improve the Input, Not the Processing Guarantees
A filtered channel can reduce irrelevant deliveries and enrichment can reduce follow-up queries. Neither provides exactly-once downstream processing.
Build idempotency around stable business/event identifiers and make recovery testable.