confluent-kafka-dotnet icon indicating copy to clipboard operation
confluent-kafka-dotnet copied to clipboard

Schema validation

Open mrkannan3 opened this issue 6 years ago • 3 comments

Description

producer is java and consumer is .NET

I would like to write a common consumer code with schema validation. The idea is to use one base-class (kafkaMessage) (through DI or partial class; we will add actual fields for each consumer) so the consumer code is reusable and no needs to change for other topics (every topics have their own fields).

I am now getting the below error. I would like to know if schema validation can skip the validation for name & namespace but do the validation for fields.

Getting mismatch validation error Avro.AvroException: Schema mismatch. Reader: {"type":"record","name":"### KafkaMessage","namespace":"### KafkaService","fields": [{"name":"empname","type":"string"},{"name":"empadd","type":"string"} {"name":"dob","type":"string"}]} writer: {"type":"record","name":"### Employee","namespace":"### com.example","fields": [{"name":"empname","type":"string"},{"name":"empadd","type":"string"} {"name":"dob","type":"string"}]}

How to reproduce

If producer's class name and package name are different than consumer's class and namespace then this error is thrown.

Please note that I am now writing both producer and consumer in .NET to test out the solution but eventually producer is going to be java.

Checklist

Please provide the following information:

  • [x] Confluent.Kafka nuget version: 1.0 beta2
  • [ ] Apache Kafka version:
  • [ ] Client configuration:
  • [ ] Operating system:
  • [ ] Provide logs (with "debug" : "..." as necessary in configuration)
  • [ ] Provide broker log excerpts
  • [ ] Critical issue

mrkannan3 avatar Jan 13 '19 06:01 mrkannan3