I am using this code to print the frequency of each number coming from test_topic_3. I ran consumer to get CSV data in test_topic_3.
KStream<String,String> inputTopic=builder.stream("test_topic_3");
KTable<String, Long> filtered = inputTopic
.selectKey((k, v) ->
{
System.out.println("key:"+k+"|| value:"+v.split(",")[1]);
return v.split(",")[1];
}
)
.groupByKey()
.count();
System.out.println("-------");
filtered.toStream().foreach((k,v)-> System.out.println(k+"|"+v));
System.out.println("-------");