Skip to content

Instantly share code, notes, and snippets.

@confluentgist
Forked from miguno/aggregation.java
Created January 9, 2020 22:16
Show Gist options
  • Save confluentgist/e4aafdb908ea0044e0adf19685b41169 to your computer and use it in GitHub Desktop.
Save confluentgist/e4aafdb908ea0044e0adf19685b41169 to your computer and use it in GitHub Desktop.
Kafka Streams Example: Continuously aggregating a stream into a table
// Continuously aggregating a KStream into a KTable.
KStream<String, String> locationUpdatesStream = ...;
KTable<String, Long> locationsPerUser
= locationUpdatesStream
.groupBy((k, v) -> v.username)
.count();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment