azure.schemaregistry.serializer.avroserializer package¶
-
class
azure.schemaregistry.serializer.avroserializer.
AvroSerializer
(**kwargs: Any)[source]¶ AvroSerializer provides the ability to serialize and deserialize data according to the given avro schema. It would automatically register, get and cache the schema.
- Keyword Arguments
client (SchemaRegistryClient) – Required. The schema registry client which is used to register schema and retrieve schema from the service.
group_name (str) – Required. Schema group under which schema should be registered.
auto_register_schemas (bool) – When true, register new schemas passed to serialize. Otherwise, and by default, fail if it has not been pre-registered in the registry.
-
close
() → None[source]¶ This method is to close the sockets opened by the client. It need not be used when using with a context manager.
-
serialize
(value: Mapping[str, Any], **kwargs: Any) → bytes[source]¶ Encode data with the given schema. The returns bytes are consisted of: The first 4 bytes denoting record format identifier. The following 32 bytes denoting schema id returned by schema registry service. The remaining bytes are the real data payload.