a learning project with 3 connector builds for kafka connect that:
- read changes from postgres;
- send events to kafka;
- can save the result to a file.
custom— the connector's java code;connector-plugins— configs for kafka connect;docker-compose.yaml— a local setup with postgres, kafka, schema registry, and connect.
-
fully custom with polling
- every few seconds the app reads new rows from the table by id
- after sending to kafka it saves the offset to a file
-
fully custom streaming
- the app reads the postgres wal with logical replication
- events go to kafka almost right away, with no polling
- a mode for streaming cdc without the kafka connect api
-
streaming with the kafka connect api
- uses
sourceconnectorandsourcetaskfrom the kafka connect api - the wal is read inside here too, but kafka connect handles startup and lifecycle
- needed when you want a full kafka connect plugin
- uses
- docker and docker compose
- java 17
- maven
docker compose up -dcd custom && mvn clean package- pick a run mode:
- custom builds: run the app's main class from the
custommodule - with the kafka connect api: put the jar into
connector-pluginsand startkafka-connect
- custom builds: run the app's main class from the