exit
fi
- docker-compose up -d zookeeper kafka cli
+ docker-compose up -d zookeeper kafka-1 kafka-2 kafka-3 cli
-if [[
- $(docker image ls -q $IMAGE) == "" ||
- "$1" = "build"
-]]
-then
- mvn install || exit
-else
- echo "Using image existing images:"
- docker image ls $IMAGE
-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
+
+ while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer..."; sleep 1; done
-sleep 5
-docker-compose exec cli kafkacat -b kafka-2:9092 -t test -q -c 10 -f'topic=%t\tpartition=%p\toffset=%o\tkey=%k\tvalue=%s\n'
-docker-compose exec cli kafkacat -b kafka-2:9092 -t test -q -c 10 -f'topic=%t\tpartition=%p\toffset=%o\tkey=%k\tvalue=%s\n'
-docker-compose exec cli kafkacat -b kafka-2:9092 -t test -q -c 10 -f'topic=%t\tpartition=%p\toffset=%o\tkey=%k\tvalue=%s\n'
++docker-compose up -d peter klaus beate franz uschi
+
+# In separatem Terminal mit zugucken mit:
+#
+# docker-compose logs --tail=10 -f
+#
- docker-compose up -d producer
- docker-compose up -d peter
- sleep 15
- docker-compose up -d beate
- sleep 15
- docker-compose stop peter
- sleep 15
++docker-compose up spikzettel &
++
++docker-compose up -d consumer-1
++sleep 7
++docker-compose up -d consumer-2
++sleep 7
++docker-compose up -d consumer-3
++sleep 1
++docker-compose stop consumer-1
++sleep 7
++docker-compose stop consumer-3
++sleep 7
++docker-compose stop consumer-2
++sleep 1
++docker-compose stop spikzettel
+
-docker-compose stop peter klaus beate franz uschi consumer-1 consumer-2 consumer-3
-docker-compose logs consumer-1
-docker-compose logs consumer-2
-docker-compose logs consumer-3
+docker-compose stop producer peter franz beate klaus
++docker-compose stop peter klaus beate franz uschi consumer-1 consumer-2 consumer-3 spikzettel
producer.bootstrap-server: kafka:9092
producer.client-id: producer
producer.topic: test
- producer.throttle-ms: 500
+
peter:
- image: juplo/endless-consumer:1.0-SNAPSHOT
- ports:
- - 8081:8080
+ image: juplo/rest-client:1.0-SNAPSHOT
+ environment:
+ server.port: 8080
+ rest-client.baseUrl: http://producer:8080
+ rest-client.username: peter
+ rest-client.throttle-ms: 1000
+
+ klaus:
+ image: juplo/rest-client:1.0-SNAPSHOT
environment:
server.port: 8080
- consumer.bootstrap-server: kafka:9092
- consumer.group-id: my-group
- consumer.client-id: peter
- consumer.topic: test
+ rest-client.baseUrl: http://producer:8080
+ rest-client.username: klaus
+ rest-client.throttle-ms: 1100
beate:
- image: juplo/endless-consumer:1.0-SNAPSHOT
- ports:
- - 8082:8080
+ image: juplo/rest-client:1.0-SNAPSHOT
environment:
server.port: 8080
- consumer.bootstrap-server: kafka:9092
- consumer.group-id: my-group
- consumer.client-id: beate
- consumer.topic: test
+ rest-client.baseUrl: http://producer:8080
+ rest-client.username: beate
+ rest-client.throttle-ms: 900
franz:
- image: juplo/endless-consumer:1.0-SNAPSHOT
- ports:
- - 8083:8080
+ image: juplo/rest-client:1.0-SNAPSHOT
environment:
server.port: 8080
- consumer.bootstrap-server: kafka:9092
- consumer.group-id: my-group
- consumer.client-id: franz
- consumer.topic: test
+ rest-client.baseUrl: http://producer:8080
+ rest-client.username: franz
+ rest-client.throttle-ms: 800
- klaus:
- image: juplo/endless-consumer:1.0-SNAPSHOT
- ports:
- - 8084:8080
+ uschi:
+ image: juplo/rest-client:1.0-SNAPSHOT
environment:
server.port: 8080
- consumer.bootstrap-server: kafka:9092
- consumer.group-id: my-group
- consumer.client-id: klaus
- consumer.topic: test
+ rest-client.baseUrl: http://producer:8080
+ rest-client.username: uschi
+ rest-client.throttle-ms: 1200
+
+ 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"
+ '