alexnikitchuk / debezium-outbox-with-protobuf

Outbox pattern using Debezium and Protobuf serialization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Start all services

docker-compose -f docker-compose.yaml up

Open terminal and connect to app database container

docker exec -it debezium-outbox-with-protobuf_app-db_1 psql -h localhost -p 5432 -U postgres postgres

Create outbox table in app database using query

CREATE TABLE public.outboxevent
(
    id uuid PRIMARY KEY,
    aggregatetype VARCHAR(75),
    aggregateid VARCHAR(50) NOT NULL,
    payload BYTEA NOT NULL
);

Open another terminal and deploy source and sink connectors to Kafka Connect

curl -i -X POST -H "Accept:application/json" -H  "Content-Type:application/json" http://localhost:8083/connectors/ -d @./connectors/outbox-connector.json
curl -i -X POST -H "Accept:application/json" -H  "Content-Type:application/json" http://localhost:8083/connectors/ -d @./connectors/target-db-sink-connector.json

Connect to target database container

docker exec -it debezium-outbox-with-protobuf_target-db_1 psql -h localhost -p 5432 -U postgres postgres

Open browser and go to URL to add new customer (can be done multiple times)

http://localhost:5000/add_new_customer

Switch back to target database terminal and check produced records appear in destination table

SELECT * FROM public.customers_topic;

About

Outbox pattern using Debezium and Protobuf serialization


Languages

Language:Python 85.7%Language:Dockerfile 14.3%