Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 1.2 KB

README.md

File metadata and controls

26 lines (17 loc) · 1.2 KB

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.

Distinct Word Count

In DistinctWordCount.scala we count distinct words in a time window via a window function.

class DistinctCountWindowFunction extends WindowFunction[WordWithCount, String, String, TimeWindow]

Top N in Window

In TopNWindow.scala we count occurrences of words and calculate the top n words by count in a time window.

Kafka source

KafkaSourceTest.scala fetches data from a kafka topic using a flink kafka consumer.

new FlinkKafkaConsumer010[String]("raw", new SimpleStringSchema(), properties))