Skip to content

Instantly share code, notes, and snippets.

Eno Thereska enothereska

Block or report user

Report or block enothereska

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View interactive-query.java
// Get the window store named "queryStoreName"
ReadOnlyWindowStore<String, Long> windowStore =
streams.store("queryStoreName", QueryableStoreTypes.windowStore());
// Fetch values for the key "europe" for all of the windows available in this application instance.
// To get *all* available windows we fetch windows from the beginning of time until now.
long timeFrom = 0; // beginning of time = oldest available
long timeTo = System.currentTimeMillis(); // now (in processing-time)
WindowStoreIterator<Long> iterator = windowStore.fetch("europe", timeFrom, timeTo);
while (iterator.hasNext()) {
View ktable-example.java
KTable<Windowed<String>, Long> aggregated = inputStream
.groupByKey()
.reduce((aggValue, newValue) -> aggValue + newValue,
TimeWindows.of(TimeUnit.MINUTES.toMillis(2))
.until(TimeUnit.DAYS.toMillis(1) /* keep for one day */),
"queryStoreName");
@enothereska
enothereska / dataflow-example.java
Created Apr 30, 2017
A Dataflow example with triggers and watermarks
View dataflow-example.java
PCollection<KV<String, Integer>> scores = input
.apply(Window.into(FixedWindows.of(Duration.standardMinutes(2)))
.triggering(
AtWatermark()
.withEarlyFirings(AtPeriod(Duration.standardMinutes(1)))
.withLateFirings(AtCount(1)))
.accumulatingAndRetractingFiredPanes())
.apply(Sum.integersPerKey())
@enothereska
enothereska / interactive-queries_song-id.md
Created Oct 3, 2016
Get details for a particular song
View interactive-queries_song-id.md
# Get all the top-5 charts across all instances
$ http://localhost:7070/kafka-music/song/9
{
  "artist":"N.W.A",
  "album":"Straight Outta Compton",
  "name":"Gangsta Gangsta"
View interactive-queries_top-five-charts-genre.md
# Get all the top-5 charts across all instances
$ http://localhost:7070/kafka-music/charts/genre/punk
[
  {
    "artist":"Wheres The Pope?",
    "album":"PSI",
View interactive-queries_top-five-charts.md
# Get all the top-5 charts across all instances
$ http://localhost:7070/kafka-music/charts/top-five
[
  {
    "artist":"Hilltop Hoods",
    "album":"The Calling",
@enothereska
enothereska / interactive-queries_app-instances-for-a-store.md
Created Oct 3, 2016
List running app instances that currently manage (parts of) state store "top-five-songs"
View interactive-queries_app-instances-for-a-store.md
# List running app instances that currently manage (parts of) state store "top-five-songs"
$ http://localhost:7070/kafka-music/instances/top-five-songs
[
	{
		"host": "localhost",
		"port": 7070,
@enothereska
enothereska / interactive-queries_list-app-instances.md
Last active Oct 31, 2018
List all running instances of this application
View interactive-queries_list-app-instances.md
# List all running instances of this application
$ http://localhost:7070/kafka-music/instances
[
	{
		"host": "localhost",
		"port": 7070,
You can’t perform that action at this time.