Tasks> userTasks() { return streamsBuilder .stream(„processEvents”, Consumed.with(serdes.forA(String.class), serdes.forA(Task.class))) .groupBy((key, task) -> task.getUser(), Serialized.with(serdes.forA(User.class), serdes.forA(Task.class))) .aggregate(Tasks::empty, (TaskAggregator<User, Task, Tasks>) (user, task, tasks) -> tasks.add(task), materializedAs(„userTasks”)); }