From 2b4d6014202cd6cb54b0c840248c54d1f1edac20 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 3 Nov 2024 11:23:15 +0100 Subject: [PATCH] `buffer.memory` konfigurierbar gemacht --- src/main/java/de/juplo/kafka/ApplicationConfiguration.java | 1 + src/main/java/de/juplo/kafka/ApplicationProperties.java | 2 ++ src/main/resources/application.yml | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java index 3666233..7540dd3 100644 --- a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java @@ -42,6 +42,7 @@ public class ApplicationConfiguration 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("buffer.memory", properties.getProducerProperties().getBufferMemory()); props.put("batch.size", properties.getProducerProperties().getBatchSize()); props.put("metadata.max.age.ms", 5000); // 5 Sekunden props.put("request.timeout.ms", 5000); // 5 Sekunden diff --git a/src/main/java/de/juplo/kafka/ApplicationProperties.java b/src/main/java/de/juplo/kafka/ApplicationProperties.java index 594fa28..4323262 100644 --- a/src/main/java/de/juplo/kafka/ApplicationProperties.java +++ b/src/main/java/de/juplo/kafka/ApplicationProperties.java @@ -49,6 +49,8 @@ public class ApplicationProperties @NotNull private Duration maxBlock; @NotNull + private Long bufferMemory; + @NotNull private Integer batchSize; @NotNull private Duration linger; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 4c6519d..98ea128 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -6,6 +6,7 @@ juplo: acks: -1 delivery-timeout: 10s max-block: 5s + buffer-memory: 33554432 batch-size: 16384 linger: 0 compression-type: gzip @@ -32,6 +33,7 @@ info: acks: ${juplo.producer.acks} delivery-timeout: ${juplo.producer.delivery-timeout} max-block: ${juplo.producer.max-block} + buffer-memory: ${juplo.producer.buffer-memory} batch-size: ${juplo.producer.batch-size} linger: ${juplo.producer.linger} compression-type: ${juplo.producer.compression-type} -- 2.20.1