Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deserializing a kafka message without schema registry

I am writing a kafka consumer that should deserialize incoming messages from avro. I do have the schema for the messages and was wondering what is the best way to deserialize those in vanilla kafka.

I searched for a while, but all the examples that I see are for File deserialization like this http://avro.apache.org/docs/1.9.0/gettingstartedjava.html and do not cover the kafka message portion.

I did use the avro maven plugin and converted my schema to the pojo class.

Any advise is appreciated!

Thank you

like image 942
user3693309 Avatar asked Oct 20 '25 05:10

user3693309


1 Answers

You need to reverse the process of the producer. If the producer used the schema registry serializer, then you will need the registry for the deserializer, regardless of having the schema on your own.

Without knowing that serializer logic, it'll be difficult to write a deserializer.

The short answer is that you would use a BinaryDecoder - just like Confluent does

like image 195
OneCricketeer Avatar answered Oct 22 '25 05:10

OneCricketeer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!