Simple Change Data Capture example with Debezium, PostgreSQL, Springboot consumer e producer sending back the data for another Kafka Topic.
Flow:
[PostgreSQL] <- [Debezium] -> [Kafka] <- [Springboot Consumer] -> [Springboot Producer] -> [Kafka]
- Docker + Docker Compose
- Kafka
- Zookeeper
- Debezium
- PostgreSQL
docker-compose up -d
docker-compose exec postgres bash
psql -h localhost -U postgres
CREATE DATABASE dummy_database;
CREATE DATABASE dummy_database;
\c dummy_database;
CREATE TABLE dummy_table(id serial PRIMARY KEY, name varchar(20), address text, age int);
insert into dummy_table(name, address, age) values('XYZ','location-A',25);
insert into dummy_table(name, address, age) values('ABC','location-B',35);
insert into dummy_table(name, address, age) values('DEF','location-C',40);
insert into dummy_table(name, address, age) values('PQR','location-D',54);
curl -X POST -H "Content-Type: application/json" --data @./debezium-cdc-connector.json localhost:8083/connectors