3

With the new Change Data Capture tool coming out soon, why would someone use this over Platform Events? My understanding is that CDC utilizes Platform Events under the hood anyways.

5

CDC and Platform Events are really different use cases.

Platform Events are a generalized event-driven, publish/subscribe mechanism. You can publish Platform Events to represent record changes (in Apex triggers that you implement), but that's not all it can do, and that use case isn't provided as out-of-the-box Platform Events functionality.

You can also, for example, use Platform Events to implement logging on incoming requests to your Apex REST services, or any one of a hundred other use cases.

CDC is something a little different, although it has in common with Platform Events that it's event-driven. It's closer, I think, to being a generalized and deepened replacement for certain use cases of the Streaming API. It's more or less narrowly targeted at specific data replication and synchronization use cases:

Receive near-real-time changes of Salesforce records, and synchronize corresponding records in an external data store.

CDC, Platform Events, and the Streaming API all use the same CometD subscription protocol, so they do have a technical underpinning in common.

6

Change Data Capture : Receive near-real-time changes of Salesforce records, and synchronize corresponding records in an external data store. Change Data Capture publishes data change events, which represent changes to Salesforce records. Changes include creation of a new record, updates to an existing record, deletion of a record, and undeletion of a record.

Platform Events : Platform events enable you to deliver secure, scalable, and customizable event notifications within Salesforce or from external sources. Platform event fields are defined in Salesforce and determine the data that you send and receive. Apps can publish and subscribe to platform events on the Lightning Platform using Apex or in external systems using CometD.

When to use Change Data Capture

  • Receive notifications of Salesforce record changes, including create, update, delete,
  • and undelete operations.
  • Capture field changes for all records.
  • Get broad access to all data regardless of sharing rules.
  • Get information about the change in the event header, such as the origin of the change, which allows ignoring changes that your client generates.
  • Perform data updates using transaction boundaries.
  • Use a versioned event schema.
  • Subscribe to mass changes in a scalable way.
  • Get access to retained events for up to three days.

CDC are specifically used in kind of a replication streaming event where as platform events are just an Enterprise level event bus using comdetD.

Below is a comparision between Events: Comparision Between Events

  • 3
    codeyinthecloud that is a nice summary. We are interested in CDC, but it turns out CDC for more than 5 objects is a paid add-on...and it's not cheap! From your summary and table, I'm struggling to see why it would be worth the money when all the other options are free. Any thoughts? – Ben Feb 4 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.