Table of Contents

Class AvroSharpMessageTypeResolver

Namespace
AvroSharp.KafkaFlow
Assembly
AvroSharp.KafkaFlow.dll

Picks the type a consumed message is read as from its writer's schema: the schema ID in the message, the schema from the registry (once per ID), and the type of that record's full name. That way one topic can carry several record types, as with the TopicRecord subject name strategy, or a top-level union of records under one subject, where the message's union branch names the record.

public sealed class AvroSharpMessageTypeResolver : IMessageTypeResolver
Inheritance
AvroSharpMessageTypeResolver
Implements
IMessageTypeResolver
Inherited Members

Remarks

The type comes from the message types given to the constructor, by each one's schema name or aliases. Without them, it is found by its .NET full name in the loaded assemblies, as KafkaFlow's Confluent Avro deserializer does, which works when the .NET names match the Avro names (as they do by default for generated types).

Constructors

AvroSharpMessageTypeResolver(ISchemaRegistryClient)

Creates a resolver that finds the type of a record's full name in the loaded assemblies, as KafkaFlow's Confluent Avro deserializer does.

AvroSharpMessageTypeResolver(ISchemaRegistryClient, IEnumerable<Type>)

Creates a resolver that picks among messageTypes, by their records' full names and aliases.

Methods

OnConsumeAsync(IMessageContext)

Gets the type of the message's writer schema.

OnProduceAsync(IMessageContext)

Does nothing: a produced message's type is its value's.