Class AvroSharpSchemaRegistrySerializer
- Namespace
- AvroSharp.Azure.SchemaRegistry
- Assembly
- AvroSharp.Azure.SchemaRegistry.dll
Writes and reads Avro messages with Azure Schema Registry, as Microsoft's SchemaRegistryAvroSerializer
(Microsoft.Azure.Data.SchemaRegistry.ApacheAvro) does, without Apache.Avro. The message is a
MessageContent, or a type derived from it, such as Event Hubs' EventData or Service Bus'
ServiceBusMessage. Its body is the Avro encoding of the value, and its content type is
avro/binary+<schema ID>.
public class AvroSharpSchemaRegistrySerializer
- Inheritance
-
AvroSharpSchemaRegistrySerializer
- Inherited Members
Remarks
The values are types AvroTypes knows (generated from .avsc files, or marked
[AvroSerializable]), and generic records (GenericRecord, or an AvroValue holding
one).
A schema is registered (or looked up) once, under its full name in the serializer's group. A writer schema is fetched by its ID once. The message is read in the writer's schema and resolved to the type's schema, so data of older and newer versions reads. A generic record is read in the writer's schema.
Its methods are virtual, and it has a protected constructor, so tests can mock it, as they can Microsoft's.
Constructors
- AvroSharpSchemaRegistrySerializer()
Creates a serializer for mocking: its methods are virtual, as in Microsoft's serializer, and this instance has no registry.
- AvroSharpSchemaRegistrySerializer(SchemaRegistryClient, string?, AvroSharpSchemaRegistrySerializerOptions?)
Creates a serializer.
Methods
- Deserialize(MessageContent, Type, CancellationToken)
Reads a message's value as
dataType.
- DeserializeAsync(MessageContent, Type, CancellationToken)
Reads a message's value as
dataType.
- DeserializeAsync<TData>(MessageContent, CancellationToken)
Reads a message's value as
TData.
- Deserialize<TData>(MessageContent, CancellationToken)
Reads a message's value as
TData.
- Serialize(object, Type?, Type?, CancellationToken)
Writes a value into a new message.
- SerializeAsync(object, Type?, Type?, CancellationToken)
Writes a value into a new message.
- SerializeAsync<TMessage, TData>(TData, CancellationToken)
Writes a value into a new message of type
TMessage.
- Serialize<TMessage, TData>(TData, CancellationToken)
Writes a value into a new message of type
TMessage.