From: Kai Moritz Date: Tue, 1 Nov 2022 10:17:32 +0000 (+0100) Subject: Compose-Setup und README.sh an überarbeitete Übung angepasst X-Git-Tag: spring-consumer--topicpartition-DEPRECATED~13 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=3b160423fb3d4fd3ca8c398d5ab88e550c472d6b;p=demos%2Fkafka%2Ftraining Compose-Setup und README.sh an überarbeitete Übung angepasst --- 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" - '