From: Kai Moritz Date: Sat, 2 Apr 2022 13:11:40 +0000 (+0200) Subject: Für null-Keys wird der String NULL gezählt X-Git-Tag: offset-endpoint~13 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=c4307f77ada5184c5c657f86ff086bdf1505c70b;p=demos%2Fkafka%2Ftraining Für null-Keys wird der String NULL gezählt --- diff --git a/src/main/java/de/juplo/kafka/EndlessConsumer.java b/src/main/java/de/juplo/kafka/EndlessConsumer.java index 063a09e..127c3d3 100644 --- a/src/main/java/de/juplo/kafka/EndlessConsumer.java +++ b/src/main/java/de/juplo/kafka/EndlessConsumer.java @@ -94,7 +94,7 @@ public class EndlessConsumer implements Runnable ); Integer partition = record.partition(); - String key = record.key(); + String key = record.key() == null ? "NULL" : record.key(); if (!seen.containsKey(partition)) seen.put(partition, new HashMap<>());