From: Kai Moritz Date: Sat, 9 Nov 2024 17:38:35 +0000 (+0100) Subject: Vorlage für die Übung zu `assign()` X-Git-Tag: consumer/spring-consumer--assign--vorlage--2024-11-13--si X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=9fcdbf828dbf5a6246d265c37c0015860dcac4a2;p=demos%2Fkafka%2Ftraining Vorlage für die Übung zu `assign()` --- diff --git a/README.sh b/README.sh deleted file mode 100755 index c504e10..0000000 --- a/README.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -IMAGE=juplo/spring-consumer:1.1-assign-SNAPSHOT - -if [ "$1" = "cleanup" ] -then - docker compose -f docker/docker-compose.yml down -t0 -v --remove-orphans - mvn clean - exit -fi - -docker compose -f docker/docker-compose.yml up -d --remove-orphans kafka-1 kafka-2 kafka-3 -docker compose -f docker/docker-compose.yml rm -svf consumer - -if [[ - $(docker image ls -q $IMAGE) == "" || - "$1" = "build" -]] -then - mvn clean install || exit -else - echo "Using image existing images:" - docker image ls $IMAGE -fi - -docker compose -f docker/docker-compose.yml up --remove-orphans setup || exit 1 - - -docker compose -f docker/docker-compose.yml up -d producer -docker compose -f docker/docker-compose.yml up -d consumer - -sleep 5 -docker compose -f docker/docker-compose.yml stop consumer - -docker compose -f docker/docker-compose.yml start consumer -sleep 5 - -docker compose -f docker/docker-compose.yml stop producer consumer -docker compose -f docker/docker-compose.yml logs consumer diff --git a/src/main/java/de/juplo/kafka/ExampleConsumer.java b/src/main/java/de/juplo/kafka/ExampleConsumer.java index 1f1986b..abd60df 100644 --- a/src/main/java/de/juplo/kafka/ExampleConsumer.java +++ b/src/main/java/de/juplo/kafka/ExampleConsumer.java @@ -54,7 +54,7 @@ public class ExampleConsumer implements Runnable .stream() .map(TopicPartition::toString) .collect(Collectors.joining(", "))); - consumer.assign(partitions); + // TODO assign to configured partitions running = true; while (running)