Class ProtobufSerializer<T>
Inheritance
ProtobufSerializer<T>
Assembly: Confluent.SchemaRegistry.Serdes.Protobuf.dll
Syntax
public class ProtobufSerializer<T> : AsyncSerializer<T, FileDescriptorSet>, IAsyncSerializer<T> where T : IMessage<T>, new()
Type Parameters
Constructors
ProtobufSerializer(ISchemaRegistryClient, ProtobufSerializerConfig, RuleRegistry)
Initialize a new instance of the ProtobufSerializer class.
Declaration
public ProtobufSerializer(ISchemaRegistryClient schemaRegistryClient, ProtobufSerializerConfig config = null, RuleRegistry ruleRegistry = null)
Parameters
Methods
IgnoreReference(string)
Declaration
protected override bool IgnoreReference(string name)
Parameters
Returns
Overrides
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)
SerializeAsync(T, SerializationContext)
Serialize an instance of type T to a byte array in Protobuf format. The serialized data is preceeded by:
- A "magic byte" (1 byte) that identifies this as a message with Confluent Platform framing.
- The id of the schema as registered in Confluent's Schema Registry (4 bytes, network byte order).
- An 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 simply a single 0 byte as an optimization. This call may block or throw on first use for a particular topic during schema registration / verification.
Declaration
public override Task<byte[]> SerializeAsync(T value, SerializationContext context)
Parameters
| Type | Name | Description |
|---|
| T | value | The value to serialize. |
| SerializationContext | context | Context relevant to the serialize operation. |
Returns
| Type | Description |
|---|
| Task<byte[]> | A Task that completes with value serialized as a byte array. |
Overrides
Confluent.SchemaRegistry.AsyncSerializer<T, Google.Protobuf.Reflection.FileDescriptorSet>.SerializeAsync(T, Confluent.Kafka.SerializationContext)
Implements