Faust序列化程序,用于序列化与Avro兼容的消息
faust-avro-serializer的Python项目详细描述
浮士德avro系列化器
此repo包含来自的avro序列化程序的改进版本
https://github.com/marcosschroh/python-schema-registry-client/。它需要模式
为了模仿Confluent的Avro SerDe的行为而存储在记录中。
它在Record
类中使用了Faust的metadata功能来读取Avro模式
动态的。在
示例
fromfaust_avro_serializerimportFaustAvroSerializerfromschema_registry.clientimportSchemaRegistryClientclassMyRecordExample:_schema={"type":"record","namespace":"com.example","name":"MyRecordExample","fields":[{"name":"foo","type":"string"},{"name":"bar","type":"string"}]}foo:strbar:strclient=SchemaRegistryClient("http://my-schema-registry:8081")serializer=FaustAvroSerializer(client,"my-subject")
当序列化程序调用_dumps
方法时,它将在
记录。
如果序列化程序找到该字段,它将解析该类并读取_schema
字段
包含Avro架构。在
- 项目
标签: