Merge der überarbeiteten Compose-Konfiguration ('endless-stream-producer') setup-partitionierung
authorKai Moritz <kai@juplo.de>
Sat, 23 Jul 2022 10:13:05 +0000 (12:13 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 23 Jul 2022 10:19:41 +0000 (12:19 +0200)
docker-compose.yml
pom.xml
src/main/java/de/juplo/kafka/DriverController.java
src/main/resources/application.yml

index 023bfdd..de99240 100644 (file)
@@ -41,6 +41,7 @@ services:
     ports:
       - 8000:8080
     environment:
+      server.port: 8080
       producer.bootstrap-server: kafka:9092
       producer.client-id: producer
       producer.topic: test
@@ -50,8 +51,9 @@ services:
   consumer:
     image: juplo/counting-consumer:1.0-SNAPSHOT
     ports:
-      - 8081:8081
+      - 8081:8080
     environment:
+      server.port: 8080
       consumer.bootstrap-server: kafka:9092
       consumer.client-id: my-group
       consumer.client-id: consumer
diff --git a/pom.xml b/pom.xml
index e7ad998..af4a89f 100644 (file)
--- a/pom.xml
+++ b/pom.xml
       <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>build-info</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>pl.project13.maven</groupId>
+        <artifactId>git-commit-id-plugin</artifactId>
       </plugin>
       <plugin>
         <groupId>io.fabric8</groupId>
index b3af107..ce4df68 100644 (file)
@@ -1,8 +1,10 @@
 package de.juplo.kafka;
 
 import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.ResponseStatus;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.concurrent.ExecutionException;
@@ -28,8 +30,9 @@ public class DriverController
   }
 
   @ExceptionHandler
+  @ResponseStatus(HttpStatus.BAD_REQUEST)
   public ErrorResponse illegalStateException(IllegalStateException e)
   {
-    return new ErrorResponse(e.getMessage(), 400);
+    return new ErrorResponse(e.getMessage(), HttpStatus.BAD_REQUEST.value());
   }
 }
index e4ae52a..7dd385b 100644 (file)
@@ -1,15 +1,32 @@
 producer:
   bootstrap-server: :9092
-  client-id: peter
+  client-id: DEV
   topic: test
   acks: 1
   throttle-ms: 1000
 management:
+  endpoint:
+    shutdown:
+      enabled: true
   endpoints:
     web:
       exposure:
         include: "*"
+  info:
+    env:
+      enabled: true
+    java:
+      enabled: true
+info:
+  kafka:
+    bootstrap-server: ${producer.bootstrap-server}
+    client-id: ${producer.client-id}
+    topic: ${producer.topic}
+    acks: ${producer.acks}
+    throttle-ms: ${producer.throttle-ms}
 logging:
   level:
     root: INFO
     de.juplo: DEBUG
+server:
+  port: 8880