Skip to content

Spring Boot Application using Kafka Consumer with Zookeeper

License

Notifications You must be signed in to change notification settings

cricketsamya/kafka-consumer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kafka-consumer

Spring Boot Application using Kafka Consumer with Zookeeper

Consumer consumes messages MessageObject(identifier=d7ea610b-9087-438c-9b52-1913a17ec2a9, action=SEND EMAIL) from producer over Kafka, and LOGs the message. Next step is to Containerize.

*Note: Java 11 is required.

Zookeeper Setup

  1. Download and Unzip Zookeeper.
  2. Goto conf directory. Then cp zoo_sample.cfg zoo.cfg
  3. Optional: Change dataDir in the zoo.cfg, as default is pointed to /tmp/data.

To start Zookeeper

  1. Goto bin folder.
  2. Execute ./zkServer.sh start

To stop Zookeeper

  1. Goto bin folder.
  2. Execute ./zkServer.sh stop

Kafka Setup

  1. Download and Unzip Kafka.
  2. Goto config folder and open server.properties.
  3. Then uncomment listeners=PLAINTEXT://:9092. This will allow Kafka broker to listen on port 9092.
  4. Optional: Change log.dirs in the server.properties.
  5. Optional: zookeeper.connect in server.properties defines Zookeeper properties.

To start Kafka

  1. Goto bin folder.
  2. Execute ./bin/kafka-server-start.sh config/server.properties

To stop Kafka

  1. Goto bin folder.
  2. Execute ./bin/kafka-server-stop.sh

To run Consumer

execute ./gradlew bootRun

*Consumer works with https://github.com/cricketsamya/kafka-producer

Releases

No releases published

Packages

No packages published

Languages