Table of Contents

Constructor AvroSharpDeserializer

Namespace
AvroSharp.Confluent
Assembly
AvroSharp.Confluent.dll

AvroSharpDeserializer(ISchemaRegistryClient, AvroSharpDeserializerConfig?, RuleRegistry?)

Creates a deserializer of a generated type or a primitive, which AvroTypes knows. On .NET Standard, pass the type's AvroTypeInfo to the other constructor, or register it first.

public AvroSharpDeserializer(ISchemaRegistryClient client, AvroSharpDeserializerConfig? config = null, RuleRegistry? ruleRegistry = null)

Parameters

client ISchemaRegistryClient

The schema registry.

config AvroSharpDeserializerConfig

The settings, or null for the defaults.

ruleRegistry RuleRegistry

The data contract rules, or null for Confluent.SchemaRegistry.RuleRegistry.GlobalInstance.

Exceptions

ArgumentException

config has a key the deserializer doesn't know, or sets Strict for a value type.

InvalidOperationException

T is not registered in AvroTypes (Confluent.Kafka's Null needn't be: its schema is "null").

AvroSharpDeserializer(ISchemaRegistryClient, IEnumerable<Type>, AvroSharpDeserializerConfig?, RuleRegistry?)

Creates a deserializer of several record types, for a topic that carries them all: each message is read as the type of its writer's record (by the record's full name, or a type's alias), or, for a top-level union of records, of the branch the message holds.

public AvroSharpDeserializer(ISchemaRegistryClient client, IEnumerable<Type> types, AvroSharpDeserializerConfig? config = null, RuleRegistry? ruleRegistry = null)

Parameters

client ISchemaRegistryClient

The schema registry.

types IEnumerable<Type>

The record types: types AvroTypes knows, each a T, of record schemas.

config AvroSharpDeserializerConfig

The settings, or null for the defaults.

ruleRegistry RuleRegistry

The data contract rules, or null for Confluent.SchemaRegistry.RuleRegistry.GlobalInstance.

Examples

new AvroSharpDeserializer<object>(registry, [typeof(OrderPlaced), typeof(OrderShipped)])

Exceptions

ArgumentException

No types are given, a type isn't a T or its schema isn't a record, two types have records of the same name or alias, or config is one the other constructors reject.

InvalidOperationException

A type is not one AvroTypes knows.

AvroSharpDeserializer(ISchemaRegistryClient, AvroTypeInfo<T>, AvroSharpDeserializerConfig?, RuleRegistry?)

Creates a deserializer of the type that type reads and writes.

public AvroSharpDeserializer(ISchemaRegistryClient client, AvroTypeInfo<T> type, AvroSharpDeserializerConfig? config = null, RuleRegistry? ruleRegistry = null)

Parameters

client ISchemaRegistryClient

The schema registry.

type AvroTypeInfo<T>

The type's schema and serializers.

config AvroSharpDeserializerConfig

The settings, or null for the defaults.

ruleRegistry RuleRegistry

The data contract rules, or null for Confluent.SchemaRegistry.RuleRegistry.GlobalInstance.

Exceptions

ArgumentException

config has a key the deserializer doesn't know, or sets Strict for a value type.