`max.block.ms` konfigurierbar gemacht
authorKai Moritz <kai@juplo.de>
Sun, 3 Nov 2024 10:20:42 +0000 (11:20 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 8 Nov 2024 17:07:12 +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 86c6726..3666233 100644 (file)
@@ -41,10 +41,10 @@ public class ApplicationConfiguration
     props.put("client.id", properties.getClientId());
     props.put("acks", properties.getProducerProperties().getAcks());
     props.put("delivery.timeout.ms", (int)properties.getProducerProperties().getDeliveryTimeout().toMillis());
+    props.put("max.block.ms", (int)properties.getProducerProperties().getMaxBlock().toMillis());
     props.put("batch.size", properties.getProducerProperties().getBatchSize());
     props.put("metadata.max.age.ms",  5000); //  5 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());
     props.put("compression.type", properties.getProducerProperties().getCompressionType());
     props.put("key.serializer", StringSerializer.class.getName());
index 5663211..594fa28 100644 (file)
@@ -47,6 +47,8 @@ public class ApplicationProperties
     @NotNull
     private Duration deliveryTimeout;
     @NotNull
+    private Duration maxBlock;
+    @NotNull
     private Integer batchSize;
     @NotNull
     private Duration linger;
index d9ff458..4c6519d 100644 (file)
@@ -5,6 +5,7 @@ juplo:
     topic: test
     acks: -1
     delivery-timeout: 10s
+    max-block: 5s
     batch-size: 16384
     linger: 0
     compression-type: gzip
@@ -30,6 +31,7 @@ info:
       topic: ${juplo.producer.topic}
       acks: ${juplo.producer.acks}
       delivery-timeout: ${juplo.producer.delivery-timeout}
+      max-block: ${juplo.producer.max-block}
       batch-size: ${juplo.producer.batch-size}
       linger: ${juplo.producer.linger}
       compression-type: ${juplo.producer.compression-type}