Skip to content

Instantly share code, notes, and snippets.

@mitch-seymour
Created December 23, 2020 23:07
Show Gist options
  • Save mitch-seymour/3b6f798e53d76a5e33eb36cf46639169 to your computer and use it in GitHub Desktop.
Save mitch-seymour/3b6f798e53d76a5e33eb36cf46639169 to your computer and use it in GitHub Desktop.
KeyValueBytesStoreSupplier storeSupplier = Stores.lruMap("counts", 10);

StreamsBuilder builder = new StreamsBuilder();
KStream<String, String> stream = builder.stream("patient-events");

stream
    .groupByKey()
    .count(
        Materialized.<String, Long>as(storeSupplier)
            .withKeySerde(Serdes.String())
            .withValueSerde(Serdes.Long()));

return builder.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment