From 1cd2d60f29b44574a2b6ca99cb7eeafa78cb4c90 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 24 Sep 2022 15:10:27 +0200 Subject: [PATCH] =?utf8?q?Compose-Setup=20=C3=BCberarbeitet:=20Grundlage?= =?utf8?q?=20f=C3=BCr=20=C3=9Cbung=20`simple-consumer-scaling`?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- README.sh | 4 ++-- docker-compose.yml | 44 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/README.sh b/README.sh index 573aba8..3c098a7 100755 --- a/README.sh +++ b/README.sh @@ -26,7 +26,7 @@ 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 up setup -docker-compose up -d +docker-compose up -d producer consumer-1 while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer..."; sleep 1; done @@ -60,4 +60,4 @@ echo foofoo | http -v :8080/bar echo barbar | http -v :8080/foo docker-compose logs producer -docker-compose logs consumer +docker-compose logs consumer-1 diff --git a/docker-compose.yml b/docker-compose.yml index 7ae8d9b..78ca5dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -83,6 +83,46 @@ services: producer.client-id: producer producer.topic: test - consumer: + peter: image: juplo/toolbox - command: kafkacat -C -b kafka:9092 -t test -o 0 -f'p=%p|o=%o|k=%k|v=%s\n' + command: > + bash -c " + while [[ true ]]; + do + echo foo | http -v producer:8080/peter; + sleep 1; + done + " + + klaus: + image: juplo/toolbox + command: > + bash -c " + while [[ true ]]; + do + echo bar | http -v producer:8080/klaus; + sleep 1; + done + " + + consumer-1: + image: juplo/simple-consumer:1.0-SNAPSHOT + command: consumer-1 + + consumer-2: + image: juplo/simple-consumer:1.0-SNAPSHOT + command: consumer-2 + + consumer-3: + image: juplo/simple-consumer:1.0-SNAPSHOT + command: consumer-3 + + spikzettel: + image: juplo/toolbox + command: > + bash -c ' + kafka-console-consumer \ + --bootstrap-server kafka:9092 \ + --topic __consumer_offsets --from-beginning \ + --formatter "kafka.coordinator.group.GroupMetadataManager\$$OffsetsMessageFormatter" + ' -- 2.20.1