top10: 1.3.0 - Refined input JSON to match the new general stats-format
[demos/kafka/wordcount] / src / main / java / de / juplo / kafka / wordcount / top10 / Top10StreamProcessor.java
index 343ab4d..907c7ff 100644 (file)
@@ -13,6 +13,8 @@ import java.util.Properties;
 @Slf4j
 public class Top10StreamProcessor
 {
+       public static final String STORE_NAME= "top10";
+
        public final KafkaStreams streams;
 
 
@@ -39,7 +41,7 @@ public class Top10StreamProcessor
 
                builder
                                .<Key, Entry>stream(inputTopic)
-                               .map((key, entry) -> new KeyValue<>(User.of(key.getUser()), entry))
+                               .map((key, entry) -> new KeyValue<>(User.of(key.getChannel()), entry))
                                .groupByKey()
                                .aggregate(
                                                () -> new Ranking(),
@@ -54,9 +56,9 @@ public class Top10StreamProcessor
                return topology;
        }
 
-       ReadOnlyKeyValueStore<User, Ranking> getStore(String name)
+       ReadOnlyKeyValueStore<User, Ranking> getStore()
        {
-               return streams.store(StoreQueryParameters.fromNameAndType(name, QueryableStoreTypes.keyValueStore()));
+               return streams.store(StoreQueryParameters.fromNameAndType(STORE_NAME, QueryableStoreTypes.keyValueStore()));
        }
 
        public void start()