Compose-Setup überarbeitet: Grundlage für Übung `simple-consumer-scaling` rest-producer---lvm-2-tage
authorKai Moritz <kai@juplo.de>
Sat, 24 Sep 2022 13:10:27 +0000 (15:10 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 24 Sep 2022 17:55:03 +0000 (19:55 +0200)
README.sh
docker-compose.yml

index 573aba8..3c098a7 100755 (executable)
--- 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
index 7ae8d9b..78ca5dd 100644 (file)
@@ -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"
+      '