Skip to content

Docker Compose Spring Boot,Debezium,Apache Kafka with outbox-pattern

Notifications You must be signed in to change notification settings

tugayesilyurt/spring-debezium-kafka-outbox-pattern

Repository files navigation

Docker Compose Spring Boot,Debezium,Apache Kafka with outbox-pattern

  • System Design

System Design

Follow the steps for building and installing

1: Build the custom-debezium-connect component.

cd debezium-transformer
mvn clean install
docker build -t custom-debezium-connect .

2: Run the Docker-Compose

docker-compose up -d

3: Linking the Debezium Kafka Connect With the Outbox Table

curl -X POST \
  http://localhost:8083/connectors/ \
  -H 'content-type: application/json' \
  -d '{
   "name": "user-outbox-connector",
   "config": {
      "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
      "tasks.max": "1",
      "database.hostname": "postgres",
      "database.port": "5432",
      "database.user": "tugayesilyurt",
      "database.password": "123456",
      "database.dbname": "userdb",
      "database.server.name": "pg-outbox-server",
      "tombstones.on.delete": "false",
      "table.whitelist": "public.outbox",
      "transforms": "outbox",
      "transforms.outbox.type": "com.transform.CustomTransformation"
   }
}

4: Don't forget the change gmail account

@Configuration
public class GmailConfig {

    @Bean("gmail")
    public JavaMailSender gmailMailSender() {
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
        mailSender.setHost("smtp.gmail.com");
        mailSender.setPort(587);

        mailSender.setUsername("CHANGE_ME");
        mailSender.setPassword("CHANGE_ME");

        Properties props = mailSender.getJavaMailProperties();
        props.put("mail.transport.protocol", "smtp");
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.debug", "false");

        return mailSender;
    }
}

5: Starting the user-service

cd user-service
mvn spring-boot:run

5: Starting the send-email-service

cd send-email-service
mvn spring-boot:run

EndPoints

Service EndPoint Method Description
Create User http://localhost:8080/v1/user POST Create User
  • Debezium Connector

Debezium Connector

  • Kafdrop

Kafdrop

  • Welcome Message

Kafdrop

About

Docker Compose Spring Boot,Debezium,Apache Kafka with outbox-pattern

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published