KTable<String, User> users = builder
.stream(
usersInputTopic,
- Consumed.with(null, new JsonSerde().copyWithType(User.class)))
+ Consumed.with(Serdes.String(), new JsonSerde().copyWithType(User.class)))
.toTable(
Materialized
.<String, User>as(userStoreSupplier)
.withKeySerde(Serdes.String())
.withValueSerde(new JsonSerde().copyWithType(User.class)));
- KStream<String, Ranking> rankings = builder.stream(rankingInputTopic);
+ KStream<String, Ranking> rankings = builder
+ .<Key, Ranking>stream(rankingInputTopic)
+ .map((key, value) -> new KeyValue<>(key.getUsername(), value));
rankings
.join(users, (ranking, user) -> UserRanking.of(
.toTable(
Materialized
.<String, UserRanking>as(rankingStoreSupplier)
+ .withKeySerde(Serdes.String())
.withValueSerde(new JsonSerde().copyWithType(UserRanking.class)));
Topology topology = builder.build();