How to Deserialising Kafka AVRO messages using Apache Beam

后端 未结 5 2116
一生所求
一生所求 2021-01-15 03:16

The main goal is the aggregate two Kafka topics, one compacted slow moving data and the other fast moving data which is received every second.

I have been able to c

5条回答
  •  春和景丽
    2021-01-15 03:38

    I had a similar issue today, and came across the following example which resolved it for me.

    https://github.com/andrewrjones/debezium-kafka-beam-example/blob/master/src/main/java/com/andrewjones/KafkaAvroConsumerExample.java

    the missing piece for me was (Class)KafkaAvroDeserializer

    KafkaIO.read()
            .withBootstrapServers("kafka:9092")
            .withTopic("dbserver1.inventory.customers")
            .withKeyDeserializer(StringDeserializer.class)
            .withValueDeserializerAndCoder((Class)KafkaAvroDeserializer.class, AvroCoder.of(MyClass.class))
    

提交回复
热议问题