Last active
March 10, 2017 16:03
-
-
Save ftrossbach/d3b235efd9d51373059d2b30c9eedc6d to your computer and use it in GitHub Desktop.
A simplified Kafka Streams topology
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KStreamBuilder builder = new KStreamBuilder(); | |
KStream<String, Long> visitsStream = builder.stream(Serdes.String(), Serdes.Long(), "visitsTopic"); | |
KGroupedStream<String, Long> groupedStream = visitsStream.groupByKey(); | |
KTable<String, Long> totalCount = groupedStream.count("totalVisitCount"); | |
KTable<Windowed<String>, Long> windowedCount = groupedStream.count(TimeWindows.of(60 * 60 * 1000), "hourlyVisitCount"); | |
groupedStream.count(SessionWindows.with(60 * 1000), "sessionVisitCount"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment