Changeset 22:b277eaa32a51

Updated docs, pom and makefile
author unexist
date Mon, 24 May 2021 20:37:22 +0200
parents f82b66d67131
children 2a53eed40f6d
files Makefile README.md pom.xml
diffstat 3 files changed, 87 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon May 24 20:09:15 2021 +0200
+++ b/Makefile	Mon May 24 20:37:22 2021 +0200
@@ -1,9 +1,9 @@
-define JSON_CONNECTOR
+define JSON_CONNECTOR_STANDALONE
 curl -X POST \
   http://localhost:8083/connectors/ \
   -H 'content-type: application/json' \
   -d '{
-	"name": "todo-outbox-connector",
+	"name": "todo-outbox-standalone-connector",
 	"config": {
 		"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
 		"tasks.max": "1",
@@ -12,15 +12,44 @@
 		"database.user": "unexist",
 		"database.password": "password",
 		"database.dbname": "showcase",
-		"database.server.name": "pg-outbox-server",
+		"database.server.name": "pg-outbox-standalone-server",
 		"tombstones.on.delete": "false",
-		"table.whitelist": "public.outbox",
+		"table.whitelist": "public.outbox_standalone",
 		"transforms": "outbox",
 		"transforms.outbox.type": "dev.unexist.showcase.transformer.TodoTransformer"
 	}
 }'
 endef
-export JSON_CONNECTOR
+export JSON_CONNECTOR_STANDALONE
+
+define JSON_CONNECTOR_EXTENSION
+curl -X POST \
+  http://localhost:8083/connectors/ \
+  -H 'content-type: application/json' \
+  -d '{
+	"name": "todo-outbox-extension-connector",
+	"config": {
+		"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
+		"tasks.max": "1",
+		"database.hostname": "postgres",
+		"database.port": "5432",
+		"database.user": "unexist",
+		"database.password": "password",
+		"database.dbname": "showcase",
+		"database.server.name": "pg-outbox-extension-server",
+		"tombstones.on.delete": "false",
+		"schema.whitelist" : "todos,todo,todo_created",
+		"table.whitelist": "public.outbox_extension",
+		"transforms": "outbox",
+		"transforms.outbox.type" : "io.debezium.transforms.outbox.EventRouter",
+		"transforms.outbox.route.by.field": "type",
+		"transforms.outbox.route.topic.replacement": "${routedByValue}",
+		"transforms.outbox.table.field.event.timestamp": "timestamp",
+		"transforms.outbox.table.fields.additional.placement": "type:header:eventType"
+	}
+}'
+endef
+export JSON_CONNECTOR_EXTENSION
 
 define JSON_TODO
 curl -X 'POST' \
@@ -39,24 +68,59 @@
 endef
 export JSON_TODO
 
-connector:
-	@echo $$JSON_CONNECTOR | bash
-
-todo:
-	@echo $$JSON_TODO | bash
-
-list:
-	curl http://localhost:8083/connectors/ | jq .
-
+# Build
 debezium:
 	cd debezium-transformer
 	mvn clean install
 
 	docker build -t showcase-debezium-connect .
 
+# Connector
+connector-create-standalone:
+	@echo $$JSON_CONNECTOR_STANDALONE | bash
+
+connector-status-standalone:
+	curl -X "GET" http://localhost:8083/connectors/todo-outbox-standalone-connector/status \
+		-H 'content-type: application/json' | jq .
+
+connector-status-extension:
+	curl -X "GET" http://localhost:8083/connectors/todo-outbox-extension-connector/status \
+		-H 'content-type: application/json' | jq .
+
+connector-create-extension:
+	@echo $$JSON_CONNECTOR_EXTENSION | bash
+
+connector-create: connector-create-standalone connector-create-extension
+
+connector-list:
+	@curl -s "http://localhost:8083/connectors"| \
+		jq '.[]'| \
+		xargs -I{connector_name} curl -s "http://localhost:8083/connectors/"{connector_name}"/status"| \
+		jq -c -M '[.name,.connector.state,.tasks[].state]|join(":|:")'| \
+		column -s : -t| \
+		sed 's/\"//g'| \
+		sort
+
+connector-delete:
+	curl -X "DELETE" "http://localhost:8083/connectors/todo-outbox-standalone-connector"
+	curl -X "DELETE" "http://localhost:8083/connectors/todo-outbox-extension-connector"
+
+# Tools
+todo:
+	@echo $$JSON_TODO | bash
+
+
 docker:
 	docker-compose up
 
-listen:
+listen-kt:
 	kt consume -topic todo_created
 
+listen-cat:
+	kafkacat -t todo_created -b localhost:9092 -C
+
+test-cat:
+	kafkacat -t todo_created -b localhost:9092 -P
+
+psql:
+	PGPASSWORD=password psql -U unexist -h localhost -d showcase
\ No newline at end of file
--- a/README.md	Mon May 24 20:09:15 2021 +0200
+++ b/README.md	Mon May 24 20:37:22 2021 +0200
@@ -1,3 +1,10 @@
 Quarkus outbox showcase
 ----
 This project holds a showcase for the transaction outbox pattern.
+
+Links
+----
+https://debezium.io/documentation/reference/integrations/outbox.html
+https://debezium.io/blog/2020/01/22/outbox-quarkus-extension/
+https://debezium.io/documentation/reference/0.9/connectors/postgresql.html
+https://docs.confluent.io/platform/current/connect/references/restapi.html
\ No newline at end of file
--- a/pom.xml	Mon May 24 20:09:15 2021 +0200
+++ b/pom.xml	Mon May 24 20:37:22 2021 +0200
@@ -15,7 +15,7 @@
 
     <modules>
         <module>debezium-transformer</module>
-        <module>todo-service-debezium</module>
+        <module>todo-service-extension</module>
         <module>todo-service-standalone</module>
     </modules>
 </project>