`delivery.timeout.ms` konfigurierbar gemacht
authorKai Moritz <kai@juplo.de>
Sun, 3 Nov 2024 08:48:46 +0000 (09:48 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 8 Nov 2024 17:07:10 +0000 (18:07 +0100)
src/main/java/de/juplo/kafka/ApplicationConfiguration.java
src/main/java/de/juplo/kafka/ApplicationProperties.java
src/main/resources/application.yml

index 5a9bd82..86c6726 100644 (file)
@@ -40,9 +40,9 @@ public class ApplicationConfiguration
     props.put("bootstrap.servers", properties.getBootstrapServer());
     props.put("client.id", properties.getClientId());
     props.put("acks", properties.getProducerProperties().getAcks());
+    props.put("delivery.timeout.ms", (int)properties.getProducerProperties().getDeliveryTimeout().toMillis());
     props.put("batch.size", properties.getProducerProperties().getBatchSize());
     props.put("metadata.max.age.ms",  5000); //  5 Sekunden
-    props.put("delivery.timeout.ms", 10000); // 10 Sekunden
     props.put("request.timeout.ms",   5000); //  5 Sekunden
     props.put("max.block.ms",         5000); //  5 Sekunden
     props.put("linger.ms", properties.getProducerProperties().getLinger().toMillis());
index ea7622e..5663211 100644 (file)
@@ -45,6 +45,8 @@ public class ApplicationProperties
     @NotEmpty
     private String acks;
     @NotNull
+    private Duration deliveryTimeout;
+    @NotNull
     private Integer batchSize;
     @NotNull
     private Duration linger;
index cb9930a..d9ff458 100644 (file)
@@ -4,6 +4,7 @@ juplo:
   producer:
     topic: test
     acks: -1
+    delivery-timeout: 10s
     batch-size: 16384
     linger: 0
     compression-type: gzip
@@ -28,6 +29,7 @@ info:
     producer:
       topic: ${juplo.producer.topic}
       acks: ${juplo.producer.acks}
+      delivery-timeout: ${juplo.producer.delivery-timeout}
       batch-size: ${juplo.producer.batch-size}
       linger: ${juplo.producer.linger}
       compression-type: ${juplo.producer.compression-type}