mvn clean aus README.sh entfernt
[demos/kafka/training] / README.sh
index 8b568c9..a659478 100755 (executable)
--- a/README.sh
+++ b/README.sh
@@ -5,11 +5,10 @@ IMAGE=juplo/rest-producer:1.0-SNAPSHOT
 if [ "$1" = "cleanup" ]
 then
   docker-compose down -v
-  mvn clean
   exit
 fi
 
-docker-compose up -d zookeeper kafka cli
+docker-compose up -d zookeeper kafka-1 kafka-2 kafka-3 cli
 
 if [[
   $(docker image ls -q $IMAGE) == "" ||
@@ -23,77 +22,29 @@ else
 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 exec cli cub kafka-ready -b kafka:9092 3 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
+while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for acks-1..."; sleep 1; done
+while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for acks-all..."; sleep 1; done
 
-http post :8081/start
+# tag::foo[]
+echo foo | http -v :8081/foo-acks-1
+echo foo | http -v :8082/foo-acks-all
+http -v :8000/seen
+# end::foo[]
 
-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
+# tag::stop[]
+docker-compose stop kafka-1
+# end::stop[]
 
-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 bar | http -v :8081/bar-acks-1
+echo bar | http -v :8082/bar-acks-all
+docker-compose exec cli kafkacat -C -b kafka:9092 -t test -o 0 -e -f'p=%p|o=%o|k=%k|v=%s\n'
 
-http :8000/seen
-http post :8000/stop
+docker-compose stop kafka-3
 
-docker-compose logs producer
+echo foobar | http -v :8081/foobar-acks-1
+echo foobar | http -v :8082/foobar-acks-all
+docker-compose exec cli kafkacat -C -b kafka:9092 -t test -o 0 -e -f'p=%p|o=%o|k=%k|v=%s\n'