This project demonstrates the power and simplicity of integrating Apache Kafka with Spring Boot for asynchronous, high-throughput messaging.
Imagine a Delivery Boy Microservice sending 1,00,000 messages 📦 (orders, locations, updates etc.), while the End User Service consumes them instantly — real-time and scalable.
- Java 17
- Spring Boot Web
- Spring Kafka
- Postman (for testing the producer API)
- REST API endpoint to publish messages to Kafka.
- Kafka consumer to process and log those messages.
- Can simulate a large number of messages (e.g., 1,00,000) efficiently.
- Easy to extend for real-time systems like food delivery, logistics, etc.
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.kafka:spring-kafka")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.kafka:spring-kafka-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}- Automatically listens on the configured topic.
- Logs messages in real-time as they arrive.
Make sure Kafka is running locally on default port (9092) or configure it in application.yml.
./gradlew bootRunSend a POST request to http://localhost:8080/location/update
Location sent to kafka topic (23, 55)
Location sent to kafka topic (45, 56)
...
Location sent to kafka topic (34, 67)