Fikri1234 / SpringBoot_Kafka_Consumer_Group_and_ReplyTo

Implement Spring boot Kafka to produce data - consumer group and reply topic to another one

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SpringBoot_Kafka_Consumer_Group_and_ReplyTo

Installation Kafka & implement Spring boot Kafka to produce data - consumer group and reply topic to another one

Prerequisites

  1. Java 8
  2. Dev Tools
  3. Lombok
  4. Zookeper
  5. Kafka
  6. Gradle

Getting Started

Architecture

Alt text

Installation & Running Zookeeper

  1. Download and extract Zookeper https://zookeeper.apache.org/releases.html
  2. Go to Zookeper directory, then open conf directory
  3. Rename file zoo_sample.cfg to zoo.cfg
  4. Create folder "dataz" inside Zookeeper directory
  5. Edit zoo.cfg and change dataDir to "Zookeper directory"/dataz
  6. Screenshot Edit zoo.cfg
  7. Run Zookeeper by open new command inside Zookeper directory and type by following command .\bin\zkServer.sh

Installation & Running Kafka

  1. Download and extract Kafka Binary https://kafka.apache.org/downloads
  2. Go to Kafka directory, then open config directory
  3. Create 3 Broker Properties by copy paste from file server.properties and rename it by following number server-1.properties, server-2.properties, server-3.properties
  4. Screenshot Edit server-1.Properties
  5. Screenshot Edit server-2.Properties
  6. Screenshot Edit server-3.Properties
  7. Run broker 1 by open cmd in Kafka directory and type .\bin\windows\kafka-server-start.bat .\config\server-1.properties
  8. Screenshot Start Broker 1
  9. Run broker 2 by open cmd in Kafka directory and type .\bin\windows\kafka-server-start.bat .\config\server-2.properties
  10. Screenshot Start Broker 2
  11. Run broker 3 by open cmd in Kafka directory and type .\bin\windows\kafka-server-start.bat .\config\server-3.properties
  12. Screenshot Start Broker 3

Spring Boot

  1. Open a new command prompt in the app directory,and type ./gradlew bootRun
  2. Hit the URL localhost:8181/send-group/ Alt text
  3. Hit the URL localhost:8181/send/ Alt text
  4. Hit the URL localhost:8181/send-reply/ Alt text

About

Implement Spring boot Kafka to produce data - consumer group and reply topic to another one


Languages

Language:Java 100.0%