Spring Boot Application with Kafka Message Producer + Zookeeper
Producer basically prepares a MessageObject(identifier=d7ea610b-9087-438c-9b52-1913a17ec2a9, action=SEND EMAIL)
and consumer can consume this message to perform certain tasks.
Currently consumer only LOGS the message data.
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