3 IMAGE=juplo/endless-consumer:1.0-SNAPSHOT
5 if [ "$1" = "cleanup" ]
12 docker-compose up -d zookeeper kafka cli
15 $(docker image ls -q $IMAGE) == "" ||
21 echo "Using image existing images:"
22 docker image ls $IMAGE
25 echo "Waiting for the Kafka-Cluster to become ready..."
26 docker-compose exec cli cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1
27 docker-compose up setup
28 docker-compose up -d producer
29 docker-compose up consumer &
30 while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer..."; sleep 1; done
32 docker-compose exec -T cli bash << 'EOF'
33 echo "Writing poison pill into topic test..."
35 echo 'BOOM!' | kafkacat -P -b kafka:9092 -t test
38 while [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Consumer is still running..."; sleep 1; done
39 http -v :8081/actuator/health
40 echo "Restarting consumer"
41 http -v post :8081/start
42 while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer..."; sleep 1; done
43 while [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Consumer is still running..."; sleep 1; done
44 http -v :8081/actuator/health
45 http -v post :8081/actuator/shutdown
46 docker-compose stop producer