Some basic and complete examples of flink stream applications. Complete in the sense that:
build.sbt
contains all the necessary dependencies,- imports are set correctly and
- code compiles.
All examples are modifications of the basic WordCount example on flink's quickstart page.
In DistinctWordCount.scala we count distinct words in a time window via a window function.
class DistinctCountWindowFunction extends WindowFunction[WordWithCount, String, String, TimeWindow]
In TopNWindow.scala we count occurrences of words and calculate the top n words by count in a time window.
KafkaSourceTest.scala fetches data from a kafka topic using a flink kafka consumer.
new FlinkKafkaConsumer010[String]("raw", new SimpleStringSchema(), properties))