This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ccm node1 cqlsh
CREATE KEYSPACE cdc_test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1};
USE cdc_test;
CREATE TABLE orders (id int, amount double, first_order boolean, PRIMARY KEY(id)) WITH cdc=true;
INSERT INTO orders (id, amount, first_order) VALUES (1, 100, true) IF NOT EXISTS;
INSERT INTO orders (id, amount, first_order) VALUES (2, 100, false) IF NOT EXISTS;
INSERT INTO orders (id, amount, first_order) VALUES (3, 100, true) IF NOT EXISTS;
INSERT INTO orders (id, amount, first_order) VALUES (4, 100, false) IF NOT EXISTS;
INSERT INTO orders (id, amount, first_order) VALUES (5, 100, true) IF NOT EXISTS;
INSERT INTO orders (id, amount, first_order) VALUES (6, 100, false) IF NOT EXISTS;
INSERT INTO orders (id, amount, first_order) VALUES (7, 100, true) IF NOT EXISTS;
INSERT INTO orders (id, amount, first_order) VALUES (8, 100, false) IF NOT EXISTS;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired from https://github.com/smartcat-labs/cassandra-kafka-connector/blob/master/cassandra-cdc/src/main/java/io/smartcat/cassandra/cdc/Reader.java
public class Reader {
private final WatchService watcher;
private final Path dir;
private final WatchKey key;
private final CommitLogReader commitLogReader;
private final CdcCommitLogReadHandler commitLogReadHandler;