From: Kai Moritz Date: Sun, 16 Jun 2024 19:38:51 +0000 (+0200) Subject: query: 2.0.1 - (GREEN) Adjusted implementation to corrected expectations X-Git-Tag: query-2.0.1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=b52ff02b6952dfc708c7c7d94205b5b24afd68f9;p=demos%2Fkafka%2Fwordcount query: 2.0.1 - (GREEN) Adjusted implementation to corrected expectations --- diff --git a/src/main/java/de/juplo/kafka/wordcount/query/Entry.java b/src/main/java/de/juplo/kafka/wordcount/query/Entry.java index 80b4daf..4be314c 100644 --- a/src/main/java/de/juplo/kafka/wordcount/query/Entry.java +++ b/src/main/java/de/juplo/kafka/wordcount/query/Entry.java @@ -7,5 +7,5 @@ import lombok.Data; public class Entry { private String word; - private Long count; + private Long counter; } diff --git a/src/main/java/de/juplo/kafka/wordcount/query/Key.java b/src/main/java/de/juplo/kafka/wordcount/query/Key.java index afeac4a..57d095a 100644 --- a/src/main/java/de/juplo/kafka/wordcount/query/Key.java +++ b/src/main/java/de/juplo/kafka/wordcount/query/Key.java @@ -6,6 +6,5 @@ import lombok.Data; @Data public class Key { - private String username; - private String word; + private String user; } diff --git a/src/main/java/de/juplo/kafka/wordcount/query/QueryStreamProcessor.java b/src/main/java/de/juplo/kafka/wordcount/query/QueryStreamProcessor.java index 3a1665f..e075eb7 100644 --- a/src/main/java/de/juplo/kafka/wordcount/query/QueryStreamProcessor.java +++ b/src/main/java/de/juplo/kafka/wordcount/query/QueryStreamProcessor.java @@ -65,7 +65,7 @@ public class QueryStreamProcessor .withValueSerde(new JsonSerde().copyWithType(User.class))); KStream rankings = builder .stream(rankingInputTopic) - .map((key, value) -> new KeyValue<>(key.getUsername(), value)); + .map((key, value) -> new KeyValue<>(key.getUser(), value)); rankings .join(users, (ranking, user) -> UserRanking.of( diff --git a/src/test/java/de/juplo/kafka/wordcount/query/TestData.java b/src/test/java/de/juplo/kafka/wordcount/query/TestData.java index cf58173..f5b8a00 100644 --- a/src/test/java/de/juplo/kafka/wordcount/query/TestData.java +++ b/src/test/java/de/juplo/kafka/wordcount/query/TestData.java @@ -70,7 +70,7 @@ class TestData { Entry entry = new Entry(); entry.setWord(testEntry.getWord()); - entry.setCount(testEntry.getCounter()); + entry.setCounter(testEntry.getCounter()); return entry; } private static KeyValue[] TOP10_MESSAGES = new KeyValue[]