Reference / template for a Kafka producer-consumer mechanism.
See also:
cd ../kafka-producer-blueprint
./gradlew clean build
cd ../kafka-consumer-blueprint
./gradlew clean build
cd ../kafka-api-blueprint
./gradlew clean build
docker-compose up --build
docker-compose exec kafka kafka-topics.sh --create --topic another-test-topic --bootstrap-server kafka:9092 --partitions 1 --replication-factor 1
docker-compose exec kafka kafka-topics.sh --list --bootstrap-server kafka:9092
-
Use Postman or a browser to access the API endpoint:
http://localhost:8083/publish?message=HelloKafka
-
The message will be forwarded to the producer application, which will then publish it to Kafka.
docker-compose down
docker-compose down -v --rmi all
- Official Gradle documentation
- Spring Boot Gradle Plugin Reference Guide
- Spring Configuration Processor
- Spring Boot DevTools
- Spring Integration
- Spring for Apache Kafka
These additional references should also help you: