Skip to content

Instantly share code, notes, and snippets.

@adamw
Created March 1, 2018 16:45
Show Gist options
  • Save adamw/aca5a17bc9281c665db51ba5e539c203 to your computer and use it in GitHub Desktop.
Save adamw/aca5a17bc9281c665db51ba5e539c203 to your computer and use it in GitHub Desktop.
KStreamBuilder builder = new KStreamBuilder();
builder.stream(keySerde, valueSerde, "my_entity_events")
.groupByKey(keySerde, valueSerde)
// the folding function: should return the new state
.reduce((currentState, event) -> ..., "my_entity_store");
.toStream(); // yields a stream of intermediate states
return builder;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment