The example of a dockerized Kafka Streams application using docker-compose. It runs the WordCount demo application that is included in the Apache Kafka documentation.
-
Execute command
sbt docker
-
In the docker folder, open the terminal and execute the command
docker-compose up -d
-
If you want to produce input messages, after 3 minutes from starting the application execute the command:
docker-compose exec broker kafka-console-producer --topic text-topic --bootstrap-server localhost:9092
-
If you want to consume output messages, execute the command:
docker-compose exec broker kafka-console-consumer --topic count-topic --from-beginning --bootstrap-server localhost:9092
-
To shut down docker application, execute the command:
docker-compose down