From 45b7b6c75e464b30d4acb79074ed3e99860763b1 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 13 Oct 2021 22:56:03 +0200 Subject: [PATCH] TODO --- .../de/juplo/kafka/wordcount/top10/Top10StreamProcessor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/juplo/kafka/wordcount/top10/Top10StreamProcessor.java b/src/main/java/de/juplo/kafka/wordcount/top10/Top10StreamProcessor.java index 276ca8e..d30e5d7 100644 --- a/src/main/java/de/juplo/kafka/wordcount/top10/Top10StreamProcessor.java +++ b/src/main/java/de/juplo/kafka/wordcount/top10/Top10StreamProcessor.java @@ -6,6 +6,7 @@ import de.juplo.kafka.wordcount.avro.Key; import de.juplo.kafka.wordcount.avro.Ranking; import io.confluent.kafka.serializers.AbstractKafkaSchemaSerDeConfig; import io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde; +import io.confluent.kafka.streams.serdes.avro.SpecificAvroSerializer; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.common.serialization.Serdes; @@ -13,6 +14,7 @@ import org.apache.kafka.streams.KafkaStreams; import org.apache.kafka.streams.KeyValue; import org.apache.kafka.streams.StreamsBuilder; import org.apache.kafka.streams.StreamsConfig; +import org.apache.kafka.streams.kstream.Consumed; import org.springframework.boot.SpringApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.stereotype.Component; @@ -43,7 +45,7 @@ public class Top10StreamProcessor StreamsBuilder builder = new StreamsBuilder(); builder - .stream(properties.getInputTopic()) + .stream(properties.getInputTopic(), Consumed.with(SpecificAvroSerializer.class, Serdes.String()) ) .map((key, count) -> new KeyValue<>( key.getUsername(), Entry.newBuilder().setWord(key.getWord()).setCount(count).build())) -- 2.20.1