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.
- Download and Unzip Zookeeper.
- Goto
conf
directory. Thencp zoo_sample.cfg zoo.cfg
- Optional: Change
dataDir
in thezoo.cfg
, as default is pointed to/tmp/data
.
- Goto
bin
folder. - Execute
./zkServer.sh start
- Goto
bin
folder. - Execute
./zkServer.sh stop
- Download and Unzip Kafka.
- Goto
config
folder and openserver.properties
. - Then uncomment
listeners=PLAINTEXT://:9092
. This will allow Kafka broker to listen on port 9092. - Optional: Change
log.dirs
in theserver.properties
. - Optional:
zookeeper.connect
inserver.properties
defines Zookeeper properties.
- Goto
bin
folder. - Execute
./bin/kafka-server-start.sh config/server.properties
- Goto
bin
folder. - Execute
./bin/kafka-server-stop.sh
execute ./gradlew bootRun
*Consumer works with https://github.com/cricketsamya/kafka-producer