From 510d12cfdbfa4fac3914b271894d6db3451eb8ee Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 8 Aug 2022 22:48:41 +0200 Subject: [PATCH] Sichergestellt, dass das neu erzeugte Topic angesprochen wird --- README.sh | 37 ++++++++++++++++++++++++++++--------- docker-compose.yml | 5 ++++- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/README.sh b/README.sh index a659478..8a9f790 100755 --- a/README.sh +++ b/README.sh @@ -29,22 +29,41 @@ docker-compose up -d 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 +kafkacat -L -b :9092 +docker-compose exec cli kafka-topics --bootstrap-server kafka:9092 --describe --topic test # tag::foo[] -echo foo | http -v :8081/foo-acks-1 -echo foo | http -v :8082/foo-acks-all -http -v :8000/seen +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' # 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 -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' +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 +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' docker-compose stop kafka-3 +kafkacat -L -b :9092 +docker-compose exec cli kafka-topics --bootstrap-server kafka:9092 --describe --topic test -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' +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' diff --git a/docker-compose.yml b/docker-compose.yml index 116cd9a..3c8ccf4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -64,9 +64,12 @@ services: image: juplo/toolbox command: > bash -c " + kafka-topics --bootstrap-server kafka:9092 --describe --topic test kafka-topics --bootstrap-server kafka:9092 --delete --if-exists --topic test kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2 --replication-factor 3 --config min.insync.replicas=2 - kafka-topics --bootstrap-server kafka:9092 --describe --topic test + kafka-topics --bootstrap-server kafka-1:9092 --describe --topic test + kafka-topics --bootstrap-server kafka-2:9092 --describe --topic test + kafka-topics --bootstrap-server kafka-3:9092 --describe --topic test " cli: -- 2.20.1