Skip to content

Basic demonstration of Apache Kafka message producer and consumer applications built with Java and Spring Boot

Notifications You must be signed in to change notification settings

hossensyedriadh/spring-boot-kafka-demo

Repository files navigation

spring-boot-kafka-demo

This repository demonstrates basic Apache Kafka message producer and consumer applications built with Java and Spring Boot.


Useful commands (for Windows):

Start up ZooKeeper:
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties

Start up Kafka:
.\bin\windows\kafka-server-start.bat .\config\server.properties

Create a Kafka topic:
.\bin\windows\kafka-topics.bat --bootstrap-server localhost:9092 -topic country --create --partitions 2 --replication-factor 1

List all topics:
.\bin\windows\kafka-topics.bat --bootstrap-server localhost:9092 -topic --list

View live message stream:
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic country --from-beginning

After startup and configuration of Kafka, start the kafka-consumer application to listen and view the messages in the kafka topic, start the kafka-producer application to publish messages to the kafka topic.