Class ProtobufDeserializer<T>
(async) Protobuf deserializer.
Inheritance
Implements
Inherited Members
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
ParseSchema(Schema)
Declaration
protected override Task<FileDescriptorSet> ParseSchema(Schema schema)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema |
Returns
Type | Description |
---|---|
Task<FileDescriptorSet> |