Constructor AvroSharpDeserializer
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
clientISchemaRegistryClientThe schema registry.
configAvroSharpDeserializerConfigThe settings, or null for the defaults.
ruleRegistryRuleRegistryThe data contract rules, or null for Confluent.SchemaRegistry.RuleRegistry.GlobalInstance.
Exceptions
- ArgumentException
confighas a key the deserializer doesn't know, or sets Strict for a value type.- InvalidOperationException
Tis not registered in AvroTypes (Confluent.Kafka'sNullneedn'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
clientISchemaRegistryClientThe schema registry.
typesIEnumerable<Type>The record types: types AvroTypes knows, each a
T, of record schemas.configAvroSharpDeserializerConfigThe settings, or null for the defaults.
ruleRegistryRuleRegistryThe 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
Tor its schema isn't a record, two types have records of the same name or alias, orconfigis 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
clientISchemaRegistryClientThe schema registry.
typeAvroTypeInfo<T>The type's schema and serializers.
configAvroSharpDeserializerConfigThe settings, or null for the defaults.
ruleRegistryRuleRegistryThe data contract rules, or null for Confluent.SchemaRegistry.RuleRegistry.GlobalInstance.
Exceptions
- ArgumentException
confighas a key the deserializer doesn't know, or sets Strict for a value type.