Skip to content

Instantly share code, notes, and snippets.

@sohangp
sohangp / error.java
Created November 20, 2019 17:52
Error
2019-11-20 12:33:17.901 ERROR 59453 --- [pool-2-thread-1] io.debezium.embedded.EmbeddedEngine : Error while trying to run connector class 'io.debezium.connector.postgresql.PostgresConnector'
Caused by: org.postgresql.util.PSQLException: ERROR: replication slot "debezium" is active for PID <>
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.core.v3.QueryExecutorImpl.processCopyResults(QueryExecutorImpl.java:1116) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.core.v3.QueryExecutorImpl.startCopy(QueryExecutorImpl.java:842) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.core.v3.replication.V3ReplicationProtocol.initializeReplication(V3ReplicationProtocol.java:58) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.core.v3.replication.V3ReplicationProtocol.startLogical(V3ReplicationProtocol.java:42) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.replication.fluent.ReplicationStreamBuilder$1.start(Repl
@sohangp
sohangp / delete.bash
Created November 19, 2019 20:32
Delete
$ curl -X GET http://localhost:9200/student/student/1?pretty=true
{
"_index" : "student",
"_type" : "student",
"_id" : "1",
"_version" : 33,
"_seq_no" : 32,
"_primary_term" : 1,
"found" : true,
"_source" : {
@sohangp
sohangp / update.bash
Created November 19, 2019 20:32
Update
$ curl -X GET http://localhost:9200/student/student/1?pretty=true
{
"_index" : "student",
"_type" : "student",
"_id" : "1",
"_version" : 32,
"_seq_no" : 31,
"_primary_term" : 1,
"found" : true,
"_source" : {
@sohangp
sohangp / insert.bash
Created November 19, 2019 20:31
Insert
$ curl -X GET http://localhost:9200/student/student/1?pretty=true
{
"_index" : "student",
"_type" : "student",
"_id" : "1",
"_version" : 31,
"_seq_no" : 30,
"_primary_term" : 1,
"found" : true,
"_source" : {
@sohangp
sohangp / delete.sql
Created November 19, 2019 20:22
DELETE FROM STUDENT
DELETE FROM STUDENT WHERE ID = 1;
@sohangp
sohangp / update.sql
Created November 19, 2019 20:21
UPDATE STUDENT
UPDATE STUDENT SET EMAIL='jill@gmail.com', NAME='Jill' WHERE ID = 1;
@sohangp
sohangp / insert.sql
Created November 19, 2019 20:20
Inserting Data
INSERT INTO STUDENT(ID, NAME, ADDRESS, EMAIL) VALUES('1','Jack','Dallas, TX','jack@gmail.com');
@sohangp
sohangp / studenttable.sql
Created November 19, 2019 20:18
Creating the Student Table
CREATE TABLE public.student
(
id integer NOT NULL,
address character varying(255),
email character varying(255),
name character varying(255),
CONSTRAINT student_pkey PRIMARY KEY (id)
);
@sohangp
sohangp / CDCListener.java
Created November 19, 2019 20:02
Starting the Embedded Engine
private final Executor executor = Executors.newSingleThreadExecutor();
...
@PostConstruct
private void start() {
this.executor.execute(engine);
}
@PreDestroy
@sohangp
sohangp / CDCListener.java
Last active November 19, 2019 19:57
Creating the EmbeddedEngine
private CDCListener(Configuration studentConnector, StudentService studentService) {
this.engine = EmbeddedEngine
.create()
.using(studentConnector)
.notifying(this::handleEvent).build();
this.studentService = studentService;
}