user3212350
user3212350

Reputation: 401

Deserialize avro to generic record without schema

Is it possible to deserialize a byte array/buffer to generic record without having any schema available, beside what's encoded in message?

I'm writing a component that takes incoming encoded message and I want to make it a generic record without having any schema on my side.

I've kind of assumed it's possible, since the schema is part of this encoded message but I'm not sure anymore, I'm getting NPE if I don't specify schema in GenericDatumReader.

Upvotes: 0

Views: 2191

Answers (1)

dhalfageme
dhalfageme

Reputation: 1545

If you embed the schema in the header it should be possible, since it is the same that if you read an .avro file where the schema is specified at first. If you serialize the avro without specifying the schema on the header I don't think it is possible to deserialize it unless you get the schema from a central service like Schema Registry or you have the schema beforehand

Upvotes: 1

Related Questions