From: Kai Moritz Date: Tue, 22 Nov 2022 20:48:57 +0000 (+0100) Subject: Setup & Vorführskript verbessert und Tags für Übung ergänzt X-Git-Tag: rest-producer X-Git-Url: https://juplo.de/gitweb/?a=commitdiff_plain;h=f3970d2c3b1b6905d9b04f95cf61d83a189fa55c;p=demos%2Fkafka%2Ftraining Setup & Vorführskript verbessert und Tags für Übung ergänzt --- diff --git a/README.sh b/README.sh index 9b15a70..3dc3476 100755 --- a/README.sh +++ b/README.sh @@ -29,10 +29,15 @@ docker-compose up -d producer while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer..."; sleep 1; done -# tag::http[] -echo -n bar | http -v :8080/foo -echo -n foo | http -v :8080/bar X-id:666 -# end::http[] -# tag::kafkacat[] -docker-compose exec cli kafkacat -b kafka:9092 -t test -f "%p|%o|%k=%s|%h\n" -e -# end::kafkacat[] +# tag::success[] +echo -n 'Hallo Welt!' | http -v :8080/foo +# end::success[] + +# tag::failure[] +dd if=/dev/zero bs=1024 count=1024 | http -v :8080/bar +# end::failure[] + +# tag::timeout[] +docker-compose stop kafka-1 kafka-2 kafka-3 +echo -n 'Hallo again...' | http -v --timeout 30 :8080/foo +# end::timeout[] diff --git a/docker-compose.yml b/docker-compose.yml index 47775e3..195ffad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,8 @@ services: KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" ports: - 9081:9081 + depends_on: + - kafka-0 kafka-2: image: bitnami/kafka:3.3.1 @@ -58,6 +60,8 @@ services: default: aliases: - kafka + depends_on: + - kafka-0 kafka-3: image: bitnami/kafka:3.3.1 @@ -77,6 +81,9 @@ services: KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" ports: - 9083:9083 + depends_on: + - kafka-0 + setup: image: juplo/toolbox @@ -86,10 +93,18 @@ services: kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2 --replication-factor 3 --config min.insync.replicas=2 kafka-topics --bootstrap-server kafka:9092 --describe --topic test " + depends_on: + - kafka-1 + - kafka-2 + - kafka-3 cli: image: juplo/toolbox command: sleep infinity + depends_on: + - kafka-1 + - kafka-2 + - kafka-3 producer: image: juplo/rest-producer:1.0-SNAPSHOT @@ -101,46 +116,6 @@ services: producer.client-id: producer producer.topic: test - peter: - 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 - rest-client.baseUrl: http://producer:8080 - rest-client.username: klaus - rest-client.throttle-ms: 1100 - - beate: - image: juplo/rest-client:1.0-SNAPSHOT - environment: - server.port: 8080 - rest-client.baseUrl: http://producer:8080 - rest-client.username: beate - rest-client.throttle-ms: 900 - - franz: - image: juplo/rest-client:1.0-SNAPSHOT - environment: - server.port: 8080 - rest-client.baseUrl: http://producer:8080 - rest-client.username: franz - rest-client.throttle-ms: 800 - - uschi: - image: juplo/rest-client:1.0-SNAPSHOT - environment: - server.port: 8080 - rest-client.baseUrl: http://producer:8080 - rest-client.username: uschi - rest-client.throttle-ms: 1200 - consumer: - image: juplo/toolbox - command: kafkacat -C -b kafka:9092 -t test -o 0 -f'p=%p|o=%o|k=%k|v=%s\n' + image: juplo/simple-consumer:1.0-SNAPSHOT + command: kafka:9092 test my-group consumer