From 262d13bfa0274005b050c7b271f867acd9809f8b Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 9 Apr 2022 18:00:48 +0200 Subject: [PATCH] =?utf8?q?Gesehene=20Schl=C3=BCssel=20sollten=20als=20long?= =?utf8?q?=20gez=C3=A4hlt=20werden?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/de/juplo/kafka/DriverController.java | 2 +- src/main/java/de/juplo/kafka/EndlessConsumer.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/juplo/kafka/DriverController.java b/src/main/java/de/juplo/kafka/DriverController.java index 1525f5a..93580ee 100644 --- a/src/main/java/de/juplo/kafka/DriverController.java +++ b/src/main/java/de/juplo/kafka/DriverController.java @@ -32,7 +32,7 @@ public class DriverController } @GetMapping("seen") - public Map> seen() + public Map> seen() { return consumer.getSeen(); } diff --git a/src/main/java/de/juplo/kafka/EndlessConsumer.java b/src/main/java/de/juplo/kafka/EndlessConsumer.java index c2d4447..bc3d357 100644 --- a/src/main/java/de/juplo/kafka/EndlessConsumer.java +++ b/src/main/java/de/juplo/kafka/EndlessConsumer.java @@ -37,7 +37,7 @@ public class EndlessConsumer implements Runnable private KafkaConsumer consumer = null; - private final Map> seen = new HashMap<>(); + private final Map> seen = new HashMap<>(); public EndlessConsumer( @@ -81,7 +81,7 @@ public class EndlessConsumer implements Runnable partitions.forEach(tp -> { log.info("{} - removing partition: {}", id, tp); - Map removed = seen.remove(tp.partition()); + Map removed = seen.remove(tp.partition()); for (String key : removed.keySet()) { log.info( @@ -127,12 +127,12 @@ public class EndlessConsumer implements Runnable Integer partition = record.partition(); String key = record.key() == null ? "NULL" : record.key(); - Map byKey = seen.get(partition); + Map byKey = seen.get(partition); if (!byKey.containsKey(key)) - byKey.put(key, 0); + byKey.put(key, 0l); - int seenByKey = byKey.get(key); + long seenByKey = byKey.get(key); seenByKey++; byKey.put(key, seenByKey); } @@ -176,7 +176,7 @@ public class EndlessConsumer implements Runnable } } - public Map> getSeen() + public Map> getSeen() { return seen; } -- 2.20.1