Verbesserungen & Korrekturen aus simple-consumer übernommen spring-consumer---lvm-2-tage--easy-path spring-consumer-DEPRECATED
authorKai Moritz <kai@juplo.de>
Wed, 23 Nov 2022 02:24:39 +0000 (03:24 +0100)
committerKai Moritz <kai@juplo.de>
Wed, 23 Nov 2022 02:48:21 +0000 (03:48 +0100)
README.sh
docker-compose.yml
pom.xml
src/main/resources/application.yml

index 53d1aa7..a749c7c 100755 (executable)
--- 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
index bd15793..5dd9834 100644 (file)
@@ -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 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -13,9 +13,9 @@
 
   <groupId>de.juplo.kafka</groupId>
   <artifactId>spring-consumer</artifactId>
-  <version>1.0-SNAPSHOT</version>
   <name>Spring Consumer</name>
   <description>Super Simple Consumer-Group, that is implemented as Spring-Boot application and configured by Spring Kafka</description>
+  <version>1.0-SNAPSHOT</version>
 
   <properties>
     <java.version>11</java.version>
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>pl.project13.maven</groupId>
+        <artifactId>git-commit-id-plugin</artifactId>
+      </plugin>
       <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
index d524e5f..b7fedad 100644 (file)
@@ -38,5 +38,6 @@ logging:
   level:
     root: INFO
     de.juplo: DEBUG
+    org.springframework.kafka: INFO
 server:
   port: 8881