If you’re currently using Salesforce Streaming APIs through Salesforce PushTopics, it’s highly recommended to consider switching to Salesforce Change Data Capture. There are several advantages to using Salesforce Change Data Capture, and two of the standout benefits are, first Change Data Capture Retention Window and the other one is simple activation.
With Salesforce Change Data Capture, you get a much longer retention window compared to Salesforce PushTopics. This means you can access and retrieve event data for a longer period, even if there are delays in processing or connecting to the service. And Enabling Salesforce Change Data Capture for an object is incredibly straightforward. Just go to the setup, navigate to Change Data Capture, and select the objects you want to start streaming. It’s a hassle-free process that gets you up and running quickly.
Salesforce has recently launched relay events in Salesforce using Change Data Capture. Here’s the link to Relay Events from Salesforce to AWS guide
What is a Change Data Capture Retention Window?
Before learning about the Retention Windows in Change Data Capture, you’ll need to know what an Event Bus is. When the Event Producer sends an Event they are stored in the Event Bus for a period of time. Subscribers retrieve events from a channel on the event bus. Here’s an image of it by Salesforce:
Events come in two types, Standard volume events, and high volume events. Standard volume events include PushTopic events and generic events whereas High-volume events include platform events and change data capture events.
The Change Data Capture Retention Window is much longer than Salesforce PushTopics. With Change Data Capture, you can keep event data for up to 72 hours, while Salesforce PushTopics only retain it for 24 hours. So, with Change Data Capture, you have an extended period to access and use the event information before it goes away.
Once a certain amount of time has passed, the events stored in the event bus are removed. However, the process of removing these events may not happen right away, causing some high-volume platform events and change data capture events to remain available even after 72 hours. It’s important to know that Salesforce doesn’t promise to keep these events stored for more than 72 hours. So, after this period, they might be gone, and you won’t be able to access them anymore.
So, I think now you know that in case the connection between the subscriber and the sender breaks off, you have a better chance of fetching old events in Salesforce Change Data Capture. In case you have any questions, hit me up on LinkedIn.
Salesforce reference: Streaming API