From cbce022445f6125f960e5095d2083e4cf58dfb5e Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 2 Apr 2022 17:18:06 +0200 Subject: [PATCH] =?utf8?q?Der=20Consumer=20erkennt=20die=20=C3=84nderung?= =?utf8?q?=20der=20Partitionierung=20schneller?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * `metadata.max.age.ms` auf 1000 heruntergesetzt (Default 5 min) * Dadurch wird die Änderung der Anzahl an Partitionen zeitnah erkannt --- README.sh | 2 +- src/main/java/de/juplo/kafka/EndlessConsumer.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.sh b/README.sh index 9ed7d6f..8315440 100755 --- a/README.sh +++ b/README.sh @@ -56,7 +56,7 @@ kafka-topics --bootstrap-server kafka:9092 --describe --topic test EOF docker-compose restart producer -sleep 10 +sleep 1 http :8081/seen sleep 1 http :8081/seen diff --git a/src/main/java/de/juplo/kafka/EndlessConsumer.java b/src/main/java/de/juplo/kafka/EndlessConsumer.java index 127c3d3..357a0b4 100644 --- a/src/main/java/de/juplo/kafka/EndlessConsumer.java +++ b/src/main/java/de/juplo/kafka/EndlessConsumer.java @@ -63,6 +63,7 @@ public class EndlessConsumer implements Runnable props.put("group.id", groupId); props.put("client.id", id); props.put("auto.offset.reset", autoOffsetReset); + props.put("metadata.max.age.ms", "1000"); props.put("key.deserializer", StringDeserializer.class.getName()); props.put("value.deserializer", StringDeserializer.class.getName()); -- 2.20.1