From 3b160423fb3d4fd3ca8c398d5ab88e550c472d6b Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 1 Nov 2022 11:17:32 +0100 Subject: [PATCH] =?utf8?q?Compose-Setup=20und=20README.sh=20an=20=C3=BCber?= =?utf8?q?arbeitete=20=C3=9Cbung=20angepasst?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- README.sh | 27 +++++++++++---------------- docker-compose.yml | 22 ---------------------- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/README.sh b/README.sh index 6030770..01d6d00 100755 --- a/README.sh +++ b/README.sh @@ -9,8 +9,9 @@ then exit fi +trap 'kill $(jobs -p) 2>/dev/null' EXIT + docker-compose up -d kafka-0 kafka-1 kafka-2 kafka-3 cli -docker-compose rm -svf consumer-1 if [[ $(docker image ls -q $IMAGE) == "" || @@ -26,18 +27,12 @@ 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 producer consumer-1 - -sleep 5 - -docker-compose restart consumer-1 - -sleep 5 - -docker-compose stop consumer-1 producer -docker-compose logs consumer-1 - -echo "Received messages for test/0" -docker-compose logs consumer-1 | grep test/0 -echo "Received messages for test/1" -docker-compose logs consumer-1 | grep test/1 +docker-compose up -d producer + +mvn spring-boot:run & +sleep 10 +kill $(jobs -p) +mvn spring-boot:run & +sleep 10 +docker-compose stop producer +kill $(jobs -p) diff --git a/docker-compose.yml b/docker-compose.yml index 293db15..6d25cc1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -94,25 +94,3 @@ services: producer: image: juplo/simple-producer:1.0-SNAPSHOT command: producer - - consumer-1: - image: juplo/simple-consumer:1.0-SNAPSHOT - command: kafka:9092 test my-group consumer-1 - - consumer-2: - image: juplo/simple-consumer:1.0-SNAPSHOT - command: kafka:9092 test my-group consumer-2 - - consumer-3: - image: juplo/simple-consumer:1.0-SNAPSHOT - command: kafka:9092 test my-group 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