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;
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;
StreamsBuilder builder = new StreamsBuilder();
builder
- .<Key, Long>stream(properties.getInputTopic())
+ .<Key, Long>stream(properties.getInputTopic(), Consumed.with(SpecificAvroSerializer.class, Serdes.String()) )
.map((key, count) -> new KeyValue<>(
key.getUsername(),
Entry.newBuilder().setWord(key.getWord()).setCount(count).build()))