import org.apache.kafka.streams.kstream.Materialized;
import org.apache.kafka.streams.state.KeyValueBytesStoreSupplier;
import org.apache.kafka.streams.state.QueryableStoreTypes;
import org.apache.kafka.streams.state.ReadOnlyKeyValueStore;
import org.apache.kafka.streams.kstream.Materialized;
import org.apache.kafka.streams.state.KeyValueBytesStoreSupplier;
import org.apache.kafka.streams.state.QueryableStoreTypes;
import org.apache.kafka.streams.state.ReadOnlyKeyValueStore;
- KStream<String, Word> source = builder.stream(
- inputTopic,
- Consumed.with(Serdes.String(), null));
-
- source
+ builder
+ .stream(
+ inputTopic,
+ Consumed.with(
+ new JsonSerde<>(User.class),
+ new JsonSerde<>(Word.class)))
.toStream()
.map((word, counter) -> new KeyValue<>(word, WordCounter.of(word, counter)))
.to(outputTopic);
.toStream()
.map((word, counter) -> new KeyValue<>(word, WordCounter.of(word, counter)))
.to(outputTopic);