confluent-kafka-dotnet
confluent-kafka-dotnet copied to clipboard
Avro.AvroException: Unable to find type 'example.test.value' when Namespace isn't 'example.test.value'
Description
Confluent.Kafka nuget version = 1.7.0 and 1.8.2 Confluent.SchemaRegistry Version=1.7.0 1.8.2 Confluent.SchemaRegistry.Serdes.Avro Version= 1.7.0 and 1.8.2 Apache Kafka version = 2.8.0 No Critical issue
ERROR xxxx - Kafka1 | Error while consuming from topics
Confluent.Kafka.ConsumeException: Local: Value deserialization error
---> Avro.AvroException: Unable to find type 'example.test.value' in all loaded assemblies
at Avro.Specific.ObjectCreator.<>c__DisplayClass14_0.<FindType>b__0(String _)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func
2 valueFactory)
at Avro.Specific.ObjectCreator.GetType(String name, Type schemaType)
at Avro.Specific.SpecificDefaultReader.ReadRecord(Object reuse, RecordSchema writerSchema, Schema readerSchema, Decoder dec)
at Avro.Generic.DefaultReader.Read[T](T reuse, Decoder decoder)
at Confluent.SchemaRegistry.Serdes.SpecificDeserializerImpl1.Deserialize(String topic, Byte[] array) at Confluent.SchemaRegistry.Serdes.AvroDeserializer
1.DeserializeAsync(ReadOnlyMemory1 data, Boolean isNull, SerializationContext context) at Confluent.Kafka.SyncOverAsync.SyncOverAsyncDeserializer
1.Deserialize(ReadOnlySpan1 data, Boolean isNull, SerializationContext context) at Confluent.Kafka.Consumer
2.Consume(Int32 millisecondsTimeout)
--- End of inner exception stack trace ---
at Confluent.Kafka.Consumer2.Consume(Int32 millisecondsTimeout) at Confluent.Kafka.Consumer
2.Consume(TimeSpan timeout)
This Error comes when consuming Avro Data from a Topic.
This error only comes when the C# namespace in that is the Avro Class isn't "example.test.value"
When changing the namespace of the class to example.test.value the error is fixed.
I want that i can use the example.test.value Schema in a Namespace that isn't example.test.value.
Is that possible?
i think this is an issue with the avro library
So open an Issue in the Avro library?
May be the same as [AVRO-3047] SpecificDatumReader fails to deserialze Records with mapped namespaces - ASF JIRA.
Perhaps, I'm missing the point. [AVRO-3047] states that the namespace of the schema is expected to match the namespace of the C# class. It is not clear to me why is this expected? If producer and consumer are written in different languages, then what the schema namespace and name have to do with actual namespace and class names of the producer and consumer data / event classes?
This is also similar to issue 1034. I will create PR with the test and fix shortly.
resolved https://github.com/confluentinc/confluent-kafka-dotnet/pull/1847
Is this fix already part of a release? Im running into a similar issue
I'm getting this error on nested objects
@Yasinkus we had a similar problem in our project. We use paket as our dependency manager, and got the following Exception while consuming: System.AggregateException : Mindestens ein Fehler ist aufgetreten. ----> Confluent.Kafka.ConsumeException : Local: Value deserialization error ----> Avro.AvroException : Unable to find type '-----' in all loaded assemblies in field ---- ----> Avro.AvroException : Unable to find type '-----' in all loaded assemblies
In our case the assemblyBindung to System.CodeDom was missing, but no way to get this information from the error message.
.netFramework 4.8 Confluent.Kafka 2.1.1 Confluent.SchemaRegistry 2.1.1 Confluent.SchemaRegistry.Serdes.Avro 2.1.1 Apache.Avro 1.11.1