I need to read Kafka messages using an avro stored in the repository. Using kafka-python 2.0.2, I can connect to the Kafka topic and read the messages but I have no idea on how to decode them.
from kafka import KafkaConsumer
consumer = KafkaConsumer('SOME-TOPIC',
other connection parameters,
auto_offset_reset= 'earliest')
# value_deserializer=lambda m: json.loads(m.decode('utf-8')))
# value_deserializer=lambda m: decode(m))
for msg in consumer:
print (msg)
What library should I use ? confluent-kafka 1.5.0, avro-python3 1.10.1 How to proceed ?
- Identify the version of the message
- Connect to the avro repository
- Get the avro with the right version
- Use it to decode the message
That seems a lot to do, is there not a simpler way to do ? I would appreciate to get an example to guide me.
To connect to the avro repository I have these parameters
- basic.auth.credentials.source
- schema.registry.basic.auth.user.info
- schema.registry.url