I am using consumer with schema registry to consume Avro data. I am using AvroDeserializer to desrialize the data. It was working fine and suddenly it started showing this error:
InnerException = {"Method not found: 'System.Threading.Tasks.Task1
Message = "Local: Value deserialization error"
StackTrace = " at Confluent.Kafka.Consumer2.Consume(Int32 millisecondsTimeout)\r\n at Confluent.Kafka.Consumer2.Consume(CancellationToken cancellationToken)\r\n `
This my consumer:
`
using (var schemaRegistry = new CachedSchemaRegistryClient(schemaRegistryConfig))
using (var consumer =
new ConsumerBuilder
.SetValueDeserializer(new AvroDeserializer
.SetErrorHandler((_, e) => Console.WriteLine($"Error: {e.Reason}"))
.Build())
{
consumer.Subscribe("topic");
try
{
while (true)
{
try
{
var consumeResult = consumer.Consume(cts.Token);
Console.WriteLine(consumeResult.Value.ToString());
}
catch (ConsumeException e)
{
Console.WriteLine($"Consume error: {e.Error.Reason}");
}
}
}
catch (OperationCanceledException)
{
consumer.Close();
}
}`
interesting. if you haven't already, try upgrading to v1.4.0 and recompiling. we made some changes that are API compatible, but require recompiling moving from v1.3.0 -> v1.4.0, it looks like you're hitting that.
@mhowlett thanks for you reply.
I am already using version 1.4.0. I tried with .net core version 3.1 and 2.2, but still didn't work. I tried Generic avro also didn't work, it only works using basic consumer without schema.
are you using Confluent.SchemaRegistry.Serdes.Avro or Confluent.SchemaRegistry.Serdes?. What you are seeing would happen I think if you're referencing Confluent.SchemaRegistry.Serdes, which has been discontinued (does not have v1.4.0).
I am using Confluent.Kafka 1.4, Confluent.SchemaRegistry 1.4, Confluent.SchemaRegistry.Serdes 1.3. I have not seen Confluent.SchemaRegistry.Serdes.Avro. For the record, everything was working fine before.
https://www.nuget.org/packages/Confluent.SchemaRegistry.Serdes.Avro/
Confluent.SchemaRegistry 1.4 and Confluent.SchemaRegistry.Serdes 1.3 are not compatible - the error you are seeing is expected.
@mhowlett Thanks, everything works fine now. I will close the issue since it is solved. Using Confluent.SchemaRegistry.Serdes.Avro insted of Confluent.SchemaRegistry.Serdes solved the problem.
Most helpful comment
https://www.nuget.org/packages/Confluent.SchemaRegistry.Serdes.Avro/
Confluent.SchemaRegistry 1.4 and Confluent.SchemaRegistry.Serdes 1.3 are not compatible - the error you are seeing is expected.