X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=README.sh;h=8b568c9537e2f6086e44052c1d18447bdb928339;hb=50da4f6f74a8f4f567b7af8556480f81256c61dc;hp=95aae0b264ea7611224ed1dc3e13e7eef97a52f5;hpb=d4bf2b7400df95df6c3f2534519671e596163be2;p=demos%2Fkafka%2Ftraining diff --git a/README.sh b/README.sh index 95aae0b..8b568c9 100755 --- a/README.sh +++ b/README.sh @@ -1,5 +1,7 @@ #!/bin/bash +IMAGE=juplo/rest-producer:1.0-SNAPSHOT + if [ "$1" = "cleanup" ] then docker-compose down -v @@ -7,27 +9,91 @@ then exit fi -mvn package || exit 1 -if [ "$1" = "build" ]; then exit; fi +docker-compose up -d zookeeper kafka cli + +if [[ + $(docker image ls -q $IMAGE) == "" || + "$1" = "build" +]] +then + mvn install || exit +else + echo "Using image existing images:" + docker image ls $IMAGE +fi -trap 'kill $(jobs -p) 2>/dev/null' EXIT +echo "Waiting for the Kafka-Cluster to become ready..." +docker-compose exec cli cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1 +docker-compose up setup docker-compose up -d -echo "Waiting for the Kafka-Cluster to become ready..." -docker-compose exec kafka cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1 - -echo "Producing messages" -mvn exec:java@producer - -echo "Reading messages" -mvn exec:java@consumer & -sleep 7 -kill $(jobs -p) -sleep 2 - -echo "Re-Reading messages" -mvn exec:java@consumer & -sleep 7 -kill $(jobs -p) -sleep 2 +sleep 15 +http :8081/status +http :8082/status +http :8083/status +http :8084/status +http :8085/status +http :8000/seen + +http post :8081/stop +http :8081/status +http :8082/status +http :8083/status +http :8084/status +http :8085/status +http :8000/seen + +http post :8081/start + +sleep 1 +http :8081/status +http :8082/status +http :8083/status +http :8084/status +http :8085/status +http :8000/seen +sleep 1 +http :8081/status +http :8082/status +http :8083/status +http :8084/status +http :8085/status +http :8000/seen +sleep 1 +http :8081/status +http :8082/status +http :8083/status +http :8084/status +http :8085/status +http :8000/seen +sleep 1 +http :8081/status +http :8082/status +http :8083/status +http :8084/status +http :8085/status +http :8000/seen +sleep 1 +http :8081/status +http :8082/status +http :8083/status +http :8084/status +http :8085/status +http :8000/seen + +http post :8081/stop +http :8081/status +http post :8082/stop +http :8082/status +http post :8083/stop +http :8083/status +http post :8084/stop +http :8084/status +http post :8085/stop +http :8085/status + +http :8000/seen +http post :8000/stop + +docker-compose logs producer