From f67c3a037050e60452a2ce15b4983828884ef9db Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 14 Jun 2023 23:58:05 +0200 Subject: [PATCH] =?utf8?q?Setup=20f=C3=BCr=20die=20Spickzettel-=C3=9Cbung?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- README.sh | 23 +++-------------------- docker/docker-compose.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/README.sh b/README.sh index 4c99f7a..82ebfd0 100755 --- a/README.sh +++ b/README.sh @@ -11,24 +11,7 @@ docker-compose -f docker/docker-compose.yml ps echo "Waiting for the Kafka-Cluster to become ready..." docker-compose -f docker/docker-compose.yml run --rm cli cub kafka-ready -b kafka:9092 3 60 > /dev/null 2>&1 || exit 1 -docker-compose -f docker/docker-compose.yml up -t0 -d cli -sleep 1 -docker-compose -f docker/docker-compose.yml logs setup +docker-compose -f docker/docker-compose.yml up -t0 -d -echo -echo "Hilfe-Ausgabe von kafkacat" -echo -docker-compose -f docker/docker-compose.yml exec -T cli kafkacat -h -echo -echo "Nachrichten schreiben mit kafkacat" -echo -docker-compose -f docker/docker-compose.yml exec -T cli kafkacat -P -b kafka:9092 -t test << EOF -Hallo Welt! -Nachricht #1 -Nachricht #2 -Nachricht #3 -EOF -echo -echo "Nachrichten lesen mit kafkacat" -echo -docker-compose -f docker/docker-compose.yml exec cli kafkacat -C -b kafka:9092 -t test -o beginning -e +echo Run: +echo docker-compose -f docker/docker-compose.yml logs -t -f spikzettel consumer-1 consumer-2 consumer-3 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3a99d56..4856fbb 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -98,3 +98,30 @@ services: command: sleep infinity depends_on: - setup + + + producer: + image: juplo/simple-producer:1.0-SNAPSHOT + command: kafka:9092 test producer + + consumer-1: + image: juplo/simple-consumer:1.0-SNAPSHOT + command: kafka:9092 test my-group consumer-1 + + consumer-2: + image: juplo/simple-consumer:1.0-SNAPSHOT + command: kafka:9092 test my-group consumer-2 + + consumer-3: + image: juplo/simple-consumer:1.0-SNAPSHOT + command: kafka:9092 test my-group consumer-3 + + spickzettel: + image: juplo/toolbox + command: > + bash -c ' + kafka-console-consumer \ + --bootstrap-server kafka:9092 \ + --topic __consumer_offsets --from-beginning \ + --formatter "kafka.coordinator.group.GroupMetadataManager\$$OffsetsMessageFormatter" + ' -- 2.20.1