From 6827d1ef322942abf7ecfa36584b9c744c8f7375 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 23 Nov 2022 03:24:39 +0100 Subject: [PATCH] =?utf8?q?Verbesserungen=20&=20Korrekturen=20aus=20simple-?= =?utf8?q?consumer=20=C3=BCbernommen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- README.sh | 24 +++++++++++++----------- docker-compose.yml | 12 +++++++++++- pom.xml | 6 +++++- src/main/resources/application.yml | 1 + 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/README.sh b/README.sh index 53d1aa7..a749c7c 100755 --- a/README.sh +++ b/README.sh @@ -4,14 +4,13 @@ IMAGE=juplo/spring-consumer:1.0-SNAPSHOT if [ "$1" = "cleanup" ] then - docker-compose down -v + docker-compose down -v --remove-orphans mvn clean 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 + +docker-compose up -d consumer +sleep 5 +docker-compose stop consumer + +docker-compose start consumer +sleep 5 -mvn spring-boot:run & -sleep 10 -kill $(jobs -p) -mvn spring-boot:run & -sleep 10 -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 bd15793..5dd9834 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -101,7 +101,17 @@ services: cli: image: juplo/toolbox command: sleep infinity + depends_on: + - kafka-1 + - kafka-2 + - kafka-3 producer: image: juplo/simple-producer:1.0-SNAPSHOT - command: producer + command: kafka:9092 test producer + + consumer: + image: juplo/spring-consumer:1.0-SNAPSHOT + environment: + spring.kafka.bootstrap-servers: kafka:9092 + spring.kafka.client-id: consumer diff --git a/pom.xml b/pom.xml index cdfb199..432efa4 100644 --- a/pom.xml +++ b/pom.xml @@ -13,9 +13,9 @@ de.juplo.kafka spring-consumer - 1.0-SNAPSHOT Spring Consumer Super Simple Consumer-Group, that is implemented as Spring-Boot application and configured by Spring Kafka + 1.0-SNAPSHOT 11 @@ -61,6 +61,10 @@ + + pl.project13.maven + git-commit-id-plugin + org.springframework.boot spring-boot-maven-plugin diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d524e5f..b7fedad 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -38,5 +38,6 @@ logging: level: root: INFO de.juplo: DEBUG + org.springframework.kafka: INFO server: port: 8881 -- 2.20.1