The "spring-kafka-app" project is a Spring Boot application that demonstrates the integration of Apache Kafka with Spring Kafka for building scalable and reactive messaging systems. It showcases how to produce and consume messages asynchronously using Kafka topics and Spring Kafka's template and listener components. This project highlights the benefits of event-driven architecture and real-time data processing using Kafka within a Spring Boot environment, making it suitable for building robust and efficient microservices and streaming applications.
Kafka application using spring boot
It will configured and pull the images and create the containers in docker Desktop
Next you must connect docker desktop before running this command:
==> docker-compose up
You can see the running containers on docker: command is:
==> docker ps (actively running)
To create topic in the Kafka: use this command:
==> docker-compose exec broker kafka-topics --create --topic my_topic --partitions 1 --replication-factor 1 --bootstrap-server broker:9092
To get list of topics use this command:
==> docker-compose exec broker kafka-topics --list --bootstrap-server broker:9092
TO Consume the events or messages from your topic producer use this command:
==> docker-compose exec broker kafka-console-consumer --topic my_topic --from-beginning --bootstrap-server broker:9092
To Produce the events or messages in your topic from using this command:
==> docker-compose exec broker kafka-console-consumer --topic my_topic --from-beginning --bootstrap-server broker:9092
To Run the spring boot application using maven library use this command:
==> ./mvnw spring-boot:run
Then configure your application with java with required dependencies in pom or gradle.
Thank You. Prabhakar-Naik.