import avro.schema from utils import fetch_schema from config import setup_producer def command_producer(topic, msg): """ Fetch the schema, create the producer instance and send the command using AvroProducer. """ schema_str_value = fetch_schema(topic) value_schema = avro.schema.Parse(schema_str_value) producer = setup_producer(value_schema) producer.produce(topic=topic, value=msg) producer.flush()