in src/Microsoft.Azure.WebJobs.Extensions.Kafka/Serialization/SerializationHelper.cs [20:39]
internal static object ResolveDeserializer(Type type, string specifiedAvroSchema, string schemaRegistryUrl, string schemaRegistryUsername, string schemaRegistryPassword)
{
if (typeof(IMessage).IsAssignableFrom(type))
{
return Activator.CreateInstance(typeof(ProtobufDeserializer<>).MakeGenericType(type));
}
var isSpecificRecord = typeof(ISpecificRecord).IsAssignableFrom(type);
if (!isSpecificRecord && !typeof(GenericRecord).IsAssignableFrom(type) && schemaRegistryUrl == null)
{
return null;
}
var schemaRegistry = CreateSchemaRegistry(type, specifiedAvroSchema, schemaRegistryUrl, schemaRegistryUsername, schemaRegistryPassword, isSpecificRecord);
var methodInfo = typeof(SerializationHelper).GetMethod(nameof(CreateAvroValueDeserializer), BindingFlags.Static | BindingFlags.NonPublic);
var genericMethod = methodInfo.MakeGenericMethod(type);
return genericMethod.Invoke(null, new object[] { schemaRegistry });
}