Demonstration für das Wordcount-Beispiel angepasst wordcount
authorKai Moritz <kai@juplo.de>
Sat, 13 Aug 2022 11:35:51 +0000 (13:35 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 13 Aug 2022 11:35:51 +0000 (13:35 +0200)
README.sh
docker-compose.yml

index b7bce99..d166ac3 100755 (executable)
--- a/README.sh
+++ b/README.sh
@@ -25,16 +25,18 @@ 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 peter beate
+docker-compose up -d
 
-sleep 15
+while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-1..."; sleep 1; done
+while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-2..."; sleep 1; done
 
-http -v post :8082/stop
 sleep 10
-docker-compose kill -s 9 peter
-http -v post :8082/start
-sleep 60
 
-docker-compose stop producer peter beate
-docker-compose logs beate
-docker-compose logs --tail=10 peter
+docker-compose stop bart nerd riddler kraut poet linux
+
+http -v :8081/seen
+http -v :8081/seen/bart
+http -v :8082/seen
+http -v :8082/seen/bart
+
+docker-compose stop consumer-1 consumer-2
index df41cb5..d855918 100644 (file)
@@ -55,6 +55,76 @@ services:
     image: juplo/toolbox
     command: sleep infinity
 
+  bart:
+    image: juplo/wordcount--fortune:1.0.0
+    command: bash -c "
+      while [ true ];
+      do
+        /usr/games/fortune chalkboard
+          | head -1
+          | http -v producer:8080/bart;
+        echo;
+        sleep 1;
+      done"
+
+  nerd:
+    image: juplo/wordcount--fortune:1.0.0
+    command: bash -c "
+      while [ true ];
+      do
+        /usr/games/fortune computers
+          | grep  -v '^[[:space:]]*--'
+          | http -v producer:8080/nerd;
+        echo;
+        sleep 1;
+      done"
+
+  riddler:
+    image: juplo/wordcount--fortune:1.0.0
+    command: bash -c "
+      while [ true ];
+      do
+        /usr/games/fortune riddles
+          | awk -F':' '/^Q/ { print $$2 }'
+          | http -v producer:8080/riddler;
+        echo;
+        sleep 1;
+        sleep 1;
+      done"
+
+  kraut:
+    image: juplo/wordcount--fortune:1.0.0
+    command: bash -c "
+      while [ true ];
+      do
+        /usr/games/fortune de
+          | http -v producer:8080/kraut;
+        echo;
+        sleep 1;
+      done"
+
+  poet:
+    image: juplo/wordcount--fortune:1.0.0
+    command: bash -c "
+      while [ true ];
+      do
+        /usr/games/fortune songs-poems
+          | http -v producer:8080/poet;
+        echo;
+        sleep 1;
+      done"
+
+  linux:
+    image: juplo/wordcount--fortune:1.0.0
+    command: bash -c "
+      while [ true ];
+      do
+        /usr/games/fortune linux
+          | http -v producer:8080/linux;
+        echo;
+        sleep 1;
+      done"
+
   producer:
     image: juplo/rest-producer:1.0-SNAPSHOT
     ports:
@@ -65,26 +135,26 @@ services:
       producer.client-id: producer
       producer.topic: test
 
-  peter:
+  consumer-1:
     image: juplo/wordcount:1.0-SNAPSHOT
     ports:
       - 8081:8080
     environment:
       server.port: 8080
       consumer.bootstrap-server: kafka:9092
-      consumer.client-id: peter
+      consumer.client-id: consumer-1
       consumer.topic: test
       spring.data.mongodb.uri: mongodb://juplo:training@mongo:27017
       spring.data.mongodb.database: juplo
 
-  beate:
+  consumer-2:
     image: juplo/wordcount:1.0-SNAPSHOT
     ports:
       - 8082:8080
     environment:
       server.port: 8080
       consumer.bootstrap-server: kafka:9092
-      consumer.client-id: beate
+      consumer.client-id: consumer-2
       consumer.topic: test
       spring.data.mongodb.uri: mongodb://juplo:training@mongo:27017
       spring.data.mongodb.database: juplo