confluent-kafka-dotnet
Show / Hide Table of Contents

Class ProtobufDeserializer<T>

(async) Protobuf deserializer.

Inheritance
object
AsyncSerde<FileDescriptorSet>
AsyncDeserializer<T, FileDescriptorSet>
ProtobufDeserializer<T>
Implements
IAsyncDeserializer<T>
Inherited Members
AsyncDeserializer<T, FileDescriptorSet>.headerSize
AsyncDeserializer<T, FileDescriptorSet>.DeserializeAsync(ReadOnlyMemory<byte>, bool, SerializationContext)
AsyncSerde<FileDescriptorSet>.schemaRegistryClient
AsyncSerde<FileDescriptorSet>.ruleRegistry
AsyncSerde<FileDescriptorSet>.useLatestVersion
AsyncSerde<FileDescriptorSet>.latestCompatibilityStrict
AsyncSerde<FileDescriptorSet>.useLatestWithMetadata
AsyncSerde<FileDescriptorSet>.subjectNameStrategy
AsyncSerde<FileDescriptorSet>.serdeMutex
AsyncSerde<FileDescriptorSet>.GetSubjectName(string, bool, string)
AsyncSerde<FileDescriptorSet>.GetSchema(string, int, string)
AsyncSerde<FileDescriptorSet>.GetParsedSchema(Schema)
AsyncSerde<FileDescriptorSet>.ResolveReferences(Schema)
AsyncSerde<FileDescriptorSet>.GetMigrations(string, Schema, Schema)
AsyncSerde<FileDescriptorSet>.GetReaderSchema(string, Schema)
AsyncSerde<FileDescriptorSet>.ExecuteMigrations(IList<Migration>, bool, string, string, Headers, object)
AsyncSerde<FileDescriptorSet>.ExecuteRules(bool, string, string, Headers, RuleMode, Schema, Schema, object, FieldTransformer)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Confluent.SchemaRegistry.Serdes
Assembly: Confluent.SchemaRegistry.Serdes.Protobuf.dll
Syntax
public class ProtobufDeserializer<T> : AsyncDeserializer<T, FileDescriptorSet>, IAsyncDeserializer<T> where T : class, IMessage<T>, new()
Type Parameters
Name Description
T
Remarks

Serialization format: byte 0: A magic byte that identifies this as a message with Confluent Platform framing. bytes 1-4: Unique global id of the Protobuf schema that was used for encoding (as registered in Confluent Schema Registry), big endian. following bytes: 1. A size-prefixed array of indices that identify the specific message type in the schema (a given schema can contain many message types and they can be nested). Size and indices are unsigned varints. The common case where the message type is the first message in the schema (i.e. index data would be [1,0]) is encoded as a single 0 byte as an optimization. 2. The protobuf serialized data.

Constructors

ProtobufDeserializer(ISchemaRegistryClient, ProtobufDeserializerConfig, RuleRegistry)

Declaration
public ProtobufDeserializer(ISchemaRegistryClient schemaRegistryClient, ProtobufDeserializerConfig config, RuleRegistry ruleRegistry = null)
Parameters
Type Name Description
ISchemaRegistryClient schemaRegistryClient
ProtobufDeserializerConfig config
RuleRegistry ruleRegistry

ProtobufDeserializer(ISchemaRegistryClient, IEnumerable<KeyValuePair<string, string>>)

Declaration
public ProtobufDeserializer(ISchemaRegistryClient schemaRegistryClient, IEnumerable<KeyValuePair<string, string>> config = null)
Parameters
Type Name Description
ISchemaRegistryClient schemaRegistryClient
IEnumerable<KeyValuePair<string, string>> config

ProtobufDeserializer(IEnumerable<KeyValuePair<string, string>>)

Initialize a new ProtobufDeserializer instance.

Declaration
public ProtobufDeserializer(IEnumerable<KeyValuePair<string, string>> config = null)
Parameters
Type Name Description
IEnumerable<KeyValuePair<string, string>> config

Deserializer configuration properties (refer to ProtobufDeserializerConfig).

Methods

DeserializeAsync(ReadOnlyMemory<byte>, bool, SerializationContext)

Deserialize an object of type T from a byte array.

Declaration
public override Task<T> DeserializeAsync(ReadOnlyMemory<byte> data, bool isNull, SerializationContext context)
Parameters
Type Name Description
ReadOnlyMemory<byte> data

The raw byte data to deserialize.

bool isNull

True if this is a null value.

SerializationContext context

Context relevant to the deserialize operation.

Returns
Type Description
Task<T>

A Task that completes with the deserialized value.

Overrides
AsyncDeserializer<T, FileDescriptorSet>.DeserializeAsync(ReadOnlyMemory<byte>, bool, SerializationContext)

ParseSchema(Schema)

Declaration
protected override Task<FileDescriptorSet> ParseSchema(Schema schema)
Parameters
Type Name Description
Schema schema
Returns
Type Description
Task<FileDescriptorSet>
Overrides
Confluent.SchemaRegistry.AsyncSerde<Google.Protobuf.Reflection.FileDescriptorSet>.ParseSchema(Confluent.SchemaRegistry.Schema)

Implements

IAsyncDeserializer<T>
In this article