X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=README.sh;h=8b568c9537e2f6086e44052c1d18447bdb928339;hb=50da4f6f74a8f4f567b7af8556480f81256c61dc;hp=0ee50a95bc364a4b808edb6947faa77a1966a0cf;hpb=aede797f2987de8c4c9c7630ce9ef73836044770;p=demos%2Fkafka%2Ftraining diff --git a/README.sh b/README.sh index 0ee50a9..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 - -trap 'kill $(jobs -p) 2>/dev/null' EXIT +docker-compose up -d zookeeper kafka cli -docker-compose up -d +if [[ + $(docker image ls -q $IMAGE) == "" || + "$1" = "build" +]] +then + mvn install || exit +else + echo "Using image existing images:" + docker image ls $IMAGE +fi 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 + +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 -echo "Producing messages" -mvn exec:java@producer +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 -echo "Reading messages" -mvn exec:java@consumer & -sleep 7 -kill $(jobs -p) -sleep 2 +http :8000/seen +http post :8000/stop -echo "Re-Reading messages" -mvn exec:java@consumer & -sleep 7 -kill $(jobs -p) -sleep 2 +docker-compose logs producer