An example Spring Boot project built with Apache Kafka.
Run docker compose file zk-single-kafka-single.yml
in detach mode (in terminal)
docker compose -f zk-single-kafka-single.yml up -d
- This will set up zookeeper and kafka in the local machine
- The Apache Kafka server will be
localhost:9092
Execute command from kafka in docker
docker exec -it kafka1 /bin/sh
Log message from kafka topic
= log
kafka-console-consumer --topic log --from-beginning --bootstrap-server localhost:9092
application.yml
connect to kafka server & set server port to 8080
server:
port: 8080
spring:
kafka:
bootstrap-servers: localhost:9092
Run the project with maven or on your ide
./mvnw.cmd
Hourmeng Khy