3 Consumern mit 3 unterschiedlichen Topics aber nur EINER Group-ID consumer/simple-consumer--megagroup--vorlage consumer/simple-consumer--megagroup--vorlage--2024-11-13--si
authorKai Moritz <kai@juplo.de>
Sat, 9 Nov 2024 08:15:08 +0000 (09:15 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 9 Nov 2024 18:19:47 +0000 (19:19 +0100)
docker/docker-compose.yml

index 3b5752c..94adb77 100644 (file)
@@ -137,11 +137,21 @@ services:
           echo -n Bereits konfiguriert: 
           cat INITIALIZED
           kafka-topics --bootstrap-server kafka:9092 --describe --topic test
+          kafka-topics --bootstrap-server kafka:9092 --describe --topic foo
+          kafka-topics --bootstrap-server kafka:9092 --describe --topic bar
         else
           kafka-topics --bootstrap-server kafka:9092 \
                        --delete \
                        --if-exists \
                        --topic test
+          kafka-topics --bootstrap-server kafka:9092 \
+                       --delete \
+                       --if-exists \
+                       --topic foo
+          kafka-topics --bootstrap-server kafka:9092 \
+                       --delete \
+                       --if-exists \
+                       --topic bar
           kafka-topics --bootstrap-server kafka:9092 \
                        --create \
                        --topic test \
@@ -150,11 +160,31 @@ services:
                        --config min.insync.replicas=2 \
           && echo Das Topic \'test\' wurde erfolgreich angelegt: \
           && kafka-topics --bootstrap-server kafka:9092 --describe --topic test \
+          && kafka-topics --bootstrap-server kafka:9092 \
+                       --create \
+                       --topic foo \
+                       --partitions 2 \
+                       --replication-factor 3 \
+                       --config min.insync.replicas=2 \
+          && echo Das Topic \'foo\' wurde erfolgreich angelegt: \
+          && kafka-topics --bootstrap-server kafka:9092 --describe --topic foo \
+          && kafka-topics --bootstrap-server kafka:9092 \
+                       --create \
+                       --topic bar \
+                       --partitions 2 \
+                       --replication-factor 3 \
+                       --config min.insync.replicas=2 \
+          && echo Das Topic \'bar\' wurde erfolgreich angelegt: \
+          && kafka-topics --bootstrap-server kafka:9092 --describe --topic bar \
           && date > INITIALIZED
         fi
     stop_grace_period: 0s
     depends_on:
       - cli
+      - akhq
+      - producer
+      - producer-foo
+      - producer-bar
 
   zoonavigator:
     image: elkozmon/zoonavigator:1.1.2
@@ -193,17 +223,25 @@ services:
     image: juplo/simple-producer:1.0-SNAPSHOT
     command: kafka:9092 test producer
 
-  consumer-1:
+  producer-foo:
+    image: juplo/simple-producer:1.0-SNAPSHOT
+    command: kafka:9092 foo producer-foo
+
+  producer-bar:
+    image: juplo/simple-producer:1.0-SNAPSHOT
+    command: kafka:9092 bar producer-bar
+
+  consumer:
     image: juplo/simple-consumer:1.0-SNAPSHOT
-    command: kafka:9092 test my-group consumer-1
+    command: kafka:9092 test my-group consumer
 
-  consumer-2:
+  consumer-foo:
     image: juplo/simple-consumer:1.0-SNAPSHOT
-    command: kafka:9092 test my-group consumer-2
+    command: kafka:9092 foo my-group consumer-foo
 
-  consumer-3:
+  consumer-bar:
     image: juplo/simple-consumer:1.0-SNAPSHOT
-    command: kafka:9092 test my-group consumer-3
+    command: kafka:9092 bar my-group consumer-bar
 
 volumes:
   zookeeper-data: