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) == "" ||
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
+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/stop
-http :8081/status
-http :8082/status
-http :8083/status
-http :8084/status
-http :8085/status
-http :8000/seen
+kafkacat -L -b :9092
+docker-compose exec cli kafka-topics --bootstrap-server kafka:9092 --describe --topic test
+# tag::foo[]
+echo foo | http -v :8081/acks-1
+echo foo | http -v :8082/acks-all
+kafkacat -C -b :9092 -t test -o 0 -e -f'p=%p|o=%o|k=%k|v=%s\n'
+# end::foo[]
+sleep 1
+kafkacat -L -b :9092
+docker-compose exec cli kafka-topics --bootstrap-server kafka:9092 --describe --topic test
+kafkacat -C -b :9092 -t test -o 0 -e -f'p=%p|o=%o|k=%k|v=%s\n'
-http post :8081/start
+# tag::stop[]
+docker-compose stop kafka-1
+kafkacat -L -b :9092
+# end::stop[]
+docker-compose exec cli kafka-topics --bootstrap-server kafka:9092 --describe --topic test
+time echo bar | http -v :8081/acks-1
+time echo bar | http -v :8081/acks-1
+time echo bar | http -v :8082/acks-all
+time echo bar | http -v :8082/acks-all
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
+kafkacat -L -b :9092
+docker-compose exec cli kafka-topics --bootstrap-server kafka:9092 --describe --topic test
+kafkacat -C -b :9092 -t test -o 0 -e -f'p=%p|o=%o|k=%k|v=%s\n'
-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
+docker-compose stop kafka-3
+kafkacat -L -b :9092
+docker-compose exec cli kafka-topics --bootstrap-server kafka:9092 --describe --topic test
-http :8000/seen
-http post :8000/stop
-
-docker-compose logs producer
+time echo foobar | http -v :8081/acks-1
+time echo foobar | http -v :8081/acks-1
+time echo foobar | http -v :8082/acks-all
+sleep 1
+kafkacat -L -b :9092
+docker-compose exec cli kafka-topics --bootstrap-server kafka:9092 --describe --topic test
+kafkacat -C -b :9092 -t test -o 0 -e -f'p=%p|o=%o|k=%k|v=%s\n'