KafkaAvroSerializer for serializing Avro without schema.registry.url

前端 未结 5 1036
轮回少年
轮回少年 2021-02-02 13:33

I\'m a noob to Kafka and Avro. So i have been trying to get the Producer/Consumer running. So far i have been able to produce and consume simple Bytes and Strings, using the fol

5条回答
  •  悲&欢浪女
    2021-02-02 13:58

    You can always make your value classes to implement Serialiser, Deserialiser (and Serde for Kafka Streams) manually. Java classes are usually generated from Avro files, so editing that directly isn't a good idea, but wrapping is maybe verbose but possible way.

    Another way is to tune Arvo generator templates that are used for Java classes generation and generate implementation of all those interfaces automatically. Both Avro maven and gradle plugins supports custom templates, so it should be easy to configure.

    I've created https://github.com/artemyarulin/avro-kafka-deserializable that has changed template files and simple CLI tool that you can use for file generation

提交回复
热议问题