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 consumer
30 docker-compose exec -T cli bash << 'EOF'
31 echo "Writing poison pill into topic test..."
33 echo 'BOOM!' | kafkacat -P -b kafka:9092 -t test
36 while [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Consumer is still running..."; sleep 1; done
37 http -v :8081/actuator/health
38 echo "Restarting consumer"
39 http -v post :8081/start
40 while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer..."; sleep 1; done
41 while [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Consumer is still running..."; sleep 1; done
42 http -v :8081/actuator/health
43 http -v post :8081/actuator/shutdown
44 docker-compose stop producer
46 docker-compose logs --tail=100 consumer