This folder contains two applications, a Producer and a Consumer using Kafka to pass messages. Here the direct instructions on how to run them together, using docker.
-
Build applications using docker. Enter in each sub-folder and type
./gradlew clean build buildDocker
-
If you didn't before, enable swarm (one time only)
docker swarm init
or
`docker swarm join`
-
Create network (one time only)
docker network create --driver overlay --attachable demo_net
-
Run
docker stack deploy --with-registry-auth -c docker/demo-swarm.yml dev
-
And when you wanto to stop
docker stack rm dev
-
Run the services
docker-compose -f docker/services.yml up -d
-
Run each service independently. Go to the sub-folder and type:
java -jar .\build\libs\kafka-mysql-spring-producer-0.0.1-SNAPSHOT.jar
java -jar .\build\libs\kafka-mysql-spring-consumer-0.0.1-SNAPSHOT.jar