Namespace AvroSharp.Messages
Single messages rather than files: the single-object encoding of the specification, and schema-registry framing.
- Single-object encoding:
AvroMessagewrites messages andAvroMessageReadercreates readers. A reader finds the writer schema by its fingerprint through anIAvroSchemaResolver;AvroSchemaStoreis the in-memory one. - Schema registries:
AvroRegistryMessageandAvroRegistryMessageReader, with anAvroRegistryFramingfor the registry's layout (Confluent, Apicurio, AWS Glue). A reader finds the schema by itsAvroSchemaIdthrough anIAvroSchemaIdResolver;AvroSchemaIdStoreis the in-memory one.ConfluentSchemaIdHeaderhandles a Confluent schema ID in a Kafka message header.
Messages hold generated types (AvroSharp.Serialization) or the generic values of AvroSharp.Generic.
Classes
- AvroMessage
Avro single-object encoding: the marker bytes
C3 01, the writer schema's 8-byte little-endian CRC-64-AVRO fingerprint, then the object's binary encoding. A reader looks the fingerprint up in an IAvroSchemaResolver to find the writer schema (see AvroMessageReader<T>).
- AvroMessageReader
Creates AvroMessageReader<T> instances.
- AvroMessageReader<T>
Reads single-object encoded messages (see AvroMessage): the fingerprint in each header selects the writer schema through an IAvroSchemaResolver, and the read function for that schema is created once and cached.
- AvroRegistryFraming
How a schema registry frames a message: the bytes in front of the Avro binary data that identify its schema. Each registry's layout is a fixed instance; see AvroRegistryMessage and AvroRegistryMessageReader<T>.
- AvroRegistryMessage
Writes messages in a schema registry's wire framing (AvroRegistryFraming): the framing's header with the schema ID, then the object's Avro binary encoding (zlib-compressed for AwsGlueCompressed). No registry client is involved: the caller supplies the ID. To read, use AvroRegistryMessageReader<T>.
- AvroRegistryMessageReader
Creates AvroRegistryMessageReader<T> instances.
- AvroRegistryMessageReader<T>
Reads messages in a schema registry's framing (AvroRegistryFraming). The ID in each header selects the writer schema through an IAvroSchemaIdResolver; the read function for each ID is created once and cached, and the ID seen last is checked before the cache, since streams of messages mostly repeat one schema.
- AvroSchemaIdStore
A thread-safe, in-memory IAvroSchemaIdResolver, for tests and for applications that know their schemas and IDs ahead of time. Its asynchronous fill only looks in memory.
- AvroSchemaStore
A thread-safe, in-memory IAvroSchemaResolver.
- ConfluentSchemaIdHeader
Confluent's schema ID in a Kafka message header (Confluent Platform 8,
HeaderSchemaIdSerializer): the header value is the byte0x01and the schema GUID as 16 big-endian bytes, and the message value is the Avro data alone. Read the value with ReadPayload(AvroSchemaId, ReadOnlySpan<byte>).
Structs
- AvroSchemaId
A schema ID as a schema registry assigns it: a number (Confluent, Apicurio) or a GUID (Confluent's version 1 framing, AWS Glue's schema version ID).
Interfaces
- IAvroSchemaIdResolver
Finds writer schemas by registry schema ID: a synchronous lookup of what is already known, and an asynchronous fill that may fetch from a registry. AvroRegistryMessageReader<T> uses the lookup on its synchronous path and the fill when ReadAsync(ReadOnlyMemory<byte>, CancellationToken) meets an ID for the first time.
- IAvroSchemaResolver
Finds writer schemas by their CRC-64-AVRO fingerprint, for reading single-object encoded messages: a synchronous lookup of what is already known, and an asynchronous one that may fetch. AvroMessageReader<T> uses the lookup in Read(ReadOnlySpan<byte>) and the asynchronous one when ReadAsync(ReadOnlyMemory<byte>, CancellationToken) meets a fingerprint for the first time. AvroSchemaStore is the in-memory implementation.