Manual Partitioning: partitioning modul 2
[demos/kafka/training] / docker-compose.yml
index 13e950d..5ce6d76 100644 (file)
@@ -24,14 +24,136 @@ services:
     depends_on:
       - zookeeper
 
-  setup:
+  kafka-ui:
+    image: provectuslabs/kafka-ui:0.2.1
+    ports:
+      - 8080:8080
+    environment:
+      KAFKA_CLUSTERS_0_NAME: local
+      KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092
+
+  cli:
+    image: juplo/toolbox
+    command: sleep infinity
+
+  producer:
+    image: juplo/manual-partitioning:1.0-SNAPSHOT
+    ports:
+      - 8000:8080
+    environment:
+      producer.bootstrap-server: kafka:9092
+      producer.client-id: producer
+      producer.topic: test
+      producer.throttle-ms: 10
+
+  count-0:
     image: juplo/toolbox
     command: >
       bash -c "
-        kafka-topics --bootstrap-server kafka:9092 --delete --if-exists --topic test
-        kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2
+        kafka-console-consumer \
+          --bootstrap-server kafka:9092 \
+          --topic test \
+          --partition 0 \
+          --property print.key=true \
+          --property print.value=false \
+          --from-beginning \
+          --timeout-ms 1000 2>/dev/null | sort | uniq -c
       "
 
-  cli:
+  count-1:
     image: juplo/toolbox
-    command: sleep infinity
+    command: >
+      bash -c "
+        kafka-console-consumer \
+          --bootstrap-server kafka:9092 \
+          --topic test \
+          --partition 1 \
+          --property print.key=true \
+          --property print.value=false \
+          --from-beginning \
+          --timeout-ms 1000 2>/dev/null | sort | uniq -c
+      "
+
+  count-2:
+    image: juplo/toolbox
+    command: >
+      bash -c "
+        kafka-console-consumer \
+          --bootstrap-server kafka:9092 \
+          --topic test \
+          --partition 2 \
+          --property print.key=true \
+          --property print.value=false \
+          --from-beginning \
+          --timeout-ms 1000 2>/dev/null | sort | uniq -c
+      "
+
+  count-3:
+    image: juplo/toolbox
+    command: >
+      bash -c "
+        kafka-console-consumer \
+          --bootstrap-server kafka:9092 \
+          --topic test \
+          --partition 3 \
+          --property print.key=true \
+          --property print.value=false \
+          --from-beginning \
+          --timeout-ms 1000 2>/dev/null | sort | uniq -c
+      "
+
+  count-4:
+    image: juplo/toolbox
+    command: >
+      bash -c "
+        kafka-console-consumer \
+          --bootstrap-server kafka:9092 \
+          --topic test \
+          --partition 4 \
+          --property print.key=true \
+          --property print.value=false \
+          --from-beginning \
+          --timeout-ms 1000 2>/dev/null | sort | uniq -c
+      "
+
+  count-5:
+    image: juplo/toolbox
+    command: >
+      bash -c "
+        kafka-console-consumer \
+          --bootstrap-server kafka:9092 \
+          --topic test \
+          --partition 5 \
+          --property print.key=true \
+          --property print.value=false \
+          --from-beginning \
+          --timeout-ms 1000 2>/dev/null | sort | uniq -c
+      "
+
+  count-6:
+    image: juplo/toolbox
+    command: >
+      bash -c "
+        kafka-console-consumer \
+          --bootstrap-server kafka:9092 \
+          --topic test \
+          --partition 6 \
+          --property print.key=true \
+          --property print.value=false \
+          --from-beginning \
+          --timeout-ms 1000 2>/dev/null | sort | uniq -c
+      "
+
+  count-7:
+    image: juplo/toolbox
+    command: >
+      bash -c "
+        kafka-console-consumer \
+          --bootstrap-server kafka:9092 \
+          --topic test \
+          --partition 7 \
+          --property print.key=true \
+          --property print.value=false \
+          --from-beginning \
+          --timeout-ms 1000 2>/dev/null | sort | uniq -c
+      "