From 95dc2a3994a80f10fc565b67690af0fba8e5a8f9 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 22 Nov 2022 20:50:02 +0100 Subject: [PATCH] =?utf8?q?Verbesserungen=20aus=20simple-producer=20=C3=BCb?= =?utf8?q?ernommen=20(insb.=20Dockerfile)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- README.sh | 18 ++++++++++-------- docker-compose.yml | 6 +++++- pom.xml | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 73b568e..3992f34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,4 +3,4 @@ VOLUME /tmp COPY target/*.jar /opt/app.jar COPY target/libs /opt/libs ENTRYPOINT [ "java", "-jar", "/opt/app.jar" ] -CMD [ "DCKR" ] +CMD [ ":9092", "test", "my-group", "DCKR" ] diff --git a/README.sh b/README.sh index 83650db..219a478 100755 --- a/README.sh +++ b/README.sh @@ -9,9 +9,8 @@ then exit fi -trap 'kill $(jobs -p) 2>/dev/null' EXIT - -docker-compose up -d kafka-0 kafka-1 kafka-2 kafka-3 cli +docker-compose up -d kafka-1 kafka-2 kafka-3 cli +docker-compose rm -svf consumer if [[ $(docker image ls -q $IMAGE) == "" || @@ -26,11 +25,14 @@ fi docker-compose up setup docker-compose up -d producer +docker-compose ps -java -jar target/simple-consumer-1.0-SNAPSHOT.jar & +docker-compose up -d consumer sleep 5 -kill $(jobs -p) -java -jar target/simple-consumer-1.0-SNAPSHOT.jar & +docker-compose stop consumer + +docker-compose start consumer sleep 5 -docker-compose stop producer -kill $(jobs -p) + +docker-compose stop producer consumer +docker-compose logs consumer diff --git a/docker-compose.yml b/docker-compose.yml index a100750..7e058c9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -108,4 +108,8 @@ services: producer: image: juplo/simple-producer:1.0-SNAPSHOT - command: producer + command: kafka:9092 test producer + + consumer: + image: juplo/simple-consumer:1.0-SNAPSHOT + command: kafka:9092 test my-group consumer diff --git a/pom.xml b/pom.xml index 2217d9b..985797b 100644 --- a/pom.xml +++ b/pom.xml @@ -13,9 +13,9 @@ de.juplo.kafka simple-consumer - 1.0-SNAPSHOT Simple Consumer-Group Super Simple Consumer-Group, that is implemented as a plain Java-program + 1.0-SNAPSHOT -- 2.20.1