Change Data Capture (CDC)

Learn how CDC solves the problem of event sourcing.

Data synchronization using change data capture (CDC)

Change data capture (CDC) is another approach used for data synchronization. It solves the asynchronous consumption of log of event sourcing, as discussed in the previous lesson.

Mitigating the problem of event sourcing

In the CDC approach, The application selects a datastore as the authoritative source of data, where all update operations are performed. It then creates an event log from this datastore that is consumed by all the remaining operations the same way as in event sourcing. This primary datastore needs to provide the necessary transactional semantics and a way to monitor changes in the underlying data to produce the event log. Relational databases are usually a good fit for this since most of them provide strong transactional guarantees. In addition, they internally use a write- ahead-log (WAL) that imposes an order on the performed operations and can feed an order event log.

Note: An example of such tool is Debezium.

As a result, clients can perform conditional updates on the current state, and the remaining applications can apply these operations independently at their datastores.

Get hands-on with 1400+ tech skills courses.