Please ignore this. Found out that the schema that was included in the
Kafka message was different than the schema of the Avro file.

On Fri, May 22, 2020 at 8:15 AM Bing Angus <angusd...@gmail.com> wrote:

>
> Hello
>
> Using Java, I create an Avro file. I send it to Kafka binary-encoded.
> Again with Java, I am able to consume the message in Kafka and successfully
> read the Avro file.
>
>
> Using Python for consumer, I am able to consume the same message but I get
> an error reading the Avro file.
>
> Environment:
> Python 3.7.4
> Avro-Python3 1.9.2.1
> Kafka-Python 2.0.1
>
> Code:
>
> consumer = KafkaConsumer(topic, conf)
> for record in consumer:
>   bytes = io.BytesIO(record.value)
>   decoder = BinaryDecoder(bytes)
>   schema = avro.schema.parse(record.headers[0][1])
>   print(schema) #ok
>   reader = DatumReader(schema)
>   genrec = reader.read(decoder) #fail
>
> Error:
> AssertionError: <some number>
> Occurs in io.py BinaryDecoder class, read_bytes()
>
>
>
> Best regards,
> Dale
>
>

Reply via email to