Vorlage
authorKai Moritz <kai@juplo.de>
Fri, 1 Apr 2022 22:46:08 +0000 (00:46 +0200)
committerKai Moritz <kai@juplo.de>
Fri, 1 Apr 2022 22:46:08 +0000 (00:46 +0200)
src/main/java/de/juplo/kafka/EndlessConsumer.java

index 063a09e..2c844a7 100644 (file)
@@ -75,39 +75,7 @@ public class EndlessConsumer implements Runnable
 
       while (true)
       {
-        ConsumerRecords<String, String> records =
-            consumer.poll(Duration.ofSeconds(1));
-
-        // Do something with the data...
-        log.info("{} - Received {} messages", id, records.count());
-        for (ConsumerRecord<String, String> record : records)
-        {
-          consumed++;
-          log.info(
-              "{} - {}: {}/{} - {}={}",
-              id,
-              record.offset(),
-              record.topic(),
-              record.partition(),
-              record.key(),
-              record.value()
-          );
-
-          Integer partition = record.partition();
-          String key = record.key();
-
-          if (!seen.containsKey(partition))
-            seen.put(partition, new HashMap<>());
-
-          Map<String, Integer> byKey = seen.get(partition);
-
-          if (!byKey.containsKey(key))
-            byKey.put(key, 0);
-
-          int seenByKey = byKey.get(key);
-          seenByKey++;
-          byKey.put(key, seenByKey);
-        }
+        // TODO: Nachrichten empfangen und zählen
       }
     }
     catch(WakeupException e)