Verbesserungen & Korrekturen aus simple-consumer übernommen supersimple-consumer---lvm-2-tage--easy-path
authorKai Moritz <kai@juplo.de>
Tue, 22 Nov 2022 22:24:17 +0000 (23:24 +0100)
committerKai Moritz <kai@juplo.de>
Tue, 22 Nov 2022 22:30:29 +0000 (23:30 +0100)
README.sh
docker-compose.yml
src/main/java/de/juplo/kafka/Application.java

index 879bae9..219a478 100755 (executable)
--- a/README.sh
+++ b/README.sh
@@ -1,23 +1,22 @@
 #!/bin/bash
 
-IMAGE=juplo/supersimple-consumer:1.0-SNAPSHOT
+IMAGE=juplo/simple-consumer:1.0-SNAPSHOT
 
 if [ "$1" = "cleanup" ]
 then
-  docker-compose down -v
+  docker-compose down -v --remove-orphans
   mvn clean
   exit
 fi
 
-docker-compose rm -svf consumer
 docker-compose up -d kafka-1 kafka-2 kafka-3 cli
+docker-compose rm -svf consumer
 
 if [[
   $(docker image ls -q $IMAGE) == "" ||
   "$1" = "build"
 ]]
 then
-  docker-compose rm -svf consumer
   mvn clean install || exit
 else
   echo "Using image existing images:"
@@ -25,14 +24,15 @@ else
 fi
 
 docker-compose up setup
-docker-compose up -d gateway requests-1 requests-2 consumer
-
-while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for gateway..."; sleep 1; done
-while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for requests-1..."; sleep 1; done
-while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for requests-2..."; sleep 1; done
+docker-compose up -d producer
+docker-compose ps
 
-echo 6 | http -v :8080/peter
+docker-compose up -d consumer
+sleep 5
+docker-compose stop consumer
 
-sleep 10
+docker-compose start consumer
+sleep 5
 
+docker-compose stop producer consumer
 docker-compose logs consumer
index 4118cc4..1d5d2fb 100644 (file)
@@ -89,56 +89,33 @@ services:
     image: juplo/toolbox
     command: >
       bash -c "
-        kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic in --partitions 2 --replication-factor 3 --config min.insync.replicas=2
-        kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic out --partitions 2 --replication-factor 3 --config min.insync.replicas=2  
-        kafka-topics --bootstrap-server kafka:9092 --describe --topic in
-        kafka-topics --bootstrap-server kafka:9092 --describe --topic out
+        kafka-topics --bootstrap-server kafka:9092 --delete --if-exists --topic test
+        kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2 --replication-factor 3 --config min.insync.replicas=2
+        kafka-topics --bootstrap-server kafka:9092 --describe --topic test
       "
     depends_on:
       - kafka-1
       - kafka-2
       - kafka-3
 
-
   cli:
     image: juplo/toolbox
     command: sleep infinity
+    depends_on:
+      - kafka-1
+      - kafka-2
+      - kafka-3
 
-  gateway:
-    image: juplo/sumup-gateway--springified:1.0-SNAPSHOT
-    ports:
-      - 8080:8080
-    environment:
-      server.port: 8080
-      spring.kafka.bootstrap-servers: kafka:9092
-      spring.kafka.client-id: gateway
-      sumup.gateway.topic: in
-
-  requests-1:
-    image: juplo/sumup-requests-json:1.0-SNAPSHOT
-    ports:
-      - 8081:8080
-    environment:
-      server.port: 8080
-      sumup.requests.bootstrap-server: kafka:9092
-      sumup.requests.client-id: requests-1
-
-  requests-2:
-    image: juplo/sumup-requests-json:1.0-SNAPSHOT
-    ports:
-      - 8082:8080
-    environment:
-      server.port: 8080
-      sumup.requests.bootstrap-server: kafka:9092
-      sumup.requests.client-id: requests-2
+  producer:
+    image: juplo/simple-producer:1.0-SNAPSHOT
+    command: kafka:9092 test producer
 
   consumer:
     image: juplo/supersimple-consumer:1.0-SNAPSHOT
     ports:
-      - 8090:8080
+      - 8080:8080
     environment:
       server.port: 8080
       spring.kafka.bootstrap-servers: kafka:9092
-      spring.kafka.producer.bootstrap-servers: kafka:9092
       spring.kafak.client-id: consumer
       logging.level.org.apache.kafka.clients.consumer: INFO
index a72431e..e3219c1 100644 (file)
@@ -10,7 +10,7 @@ import org.springframework.kafka.annotation.KafkaListener;
 @Slf4j
 public class Application
 {
-  @KafkaListener(id = "supersimple", topics = "out")
+  @KafkaListener(id = "supersimple", topics = "test")
   public void recieve(String message)
   {
     log.info("Recieved message: {}", message);
@@ -21,4 +21,4 @@ public class Application
     SpringApplication.run(Application.class, args);
   }
 }
-// end::supersimple[]
\ No newline at end of file
+// end::supersimple[]