← All articles
MuleSoft · Salesforce · Pub/Sub API · Change Data Capture · Platform Events

Salesforce Pub/Sub Connector in MuleSoft: CDC, Platform Events, Replay, and Recovery

Salesforce Pub/Sub API provides a modern event interface for Change Data Capture and Platform Events. MuleSoft's Salesforce Pub/Sub Connector exposes that model directly to Mule applications.

Connector choice matters

Do not confuse Salesforce Connector and Salesforce Pub/Sub Connector. The general Salesforce Connector supports several Salesforce APIs and operations. Salesforce Pub/Sub Connector is focused on publishing/subscribing through Salesforce Pub/Sub API.

Current MuleSoft documentation lists Pub/Sub Connector 1.4.x and supports OAuth-based connection types including OAuth JWT and OAuth Client Credentials.

Subscribe Channel Listener

A subscription identifies a published Salesforce channel and a replay strategy. Current documentation exposes four replay options:

  • Latest - new events after subscription;
  • Earliest - retained events plus new events;
  • Custom replay id - events after a specified replay ID;
  • Replay id from object store - obtain the checkpoint from Mule Object Store.

Durable replay pattern

Salesforce channel
   → Pub/Sub Connector
   → validate/transform
   → downstream durable success
   → persist replay checkpoint

The ordering is important. Persisting the checkpoint before downstream success can create a recovery gap.

MuleSoft documents an Object Store replay option. If no replay value is found, the documented behavior defaults to Earliest.

Batch size is a trade-off

Pub/Sub Connector requests event batches. A larger batch can reduce server calls but increases memory/work in flight. A smaller batch reduces the footprint but requires more calls. Tune against actual processing latency and downstream capacity rather than choosing the maximum automatically.

CDC semantics

CDC consumers must distinguish event metadata from changed business fields. The consumer should also be idempotent because replay/recovery can legitimately cause an already-processed business change to be seen again.

Platform Events

For Platform Events, design a stable event contract and avoid assuming that receipt equals completion of downstream work. Acknowledge/checkpoint only at the point consistent with the application's delivery guarantees.

References

CONTINUE READING

Explore closely related architecture, integration and implementation topics.