我在我的项目中使用 Apache Avro,并且我需要将即将到来的 protobuf 数据保存在 Avro Schema 中。我在互联网上搜索但没有找到任何解决方案。
我该怎么做?
You can not deserialize protobuf data by using the apache avro serialization system because they don't use the same encoder/decoder protocol.
One way to solve your problem is to create an interface system which deserializes the protobuf upcoming data (by using the protobuf system). After this step, you can easily fill your generated class with the data decrypted.
我实现了从协议缓冲区到 avro 记录的转换,您可以尝试一下: https ://github.com/cecol/protobuf-to-avro 但您仍然需要提供正确的协议缓冲区架构 .proto 文件并对应 avro .avsc 文件架构