aiokafka
aiokafka copied to clipboard
async with AIOKafkaProducer() fails with AttributeError
Describe the bug
async with AIOKafkaProducer(...) as producer:
producer.send(...)
fails with AttributeError: 'NoneType' object has no attribute 'send'. producer is indeed None.
Expected behaviour
producer is an AIOKafkaProducer object.
Environment (please complete the following information):
- aiokafka version (
python -c "import aiokafka; print(aiokafka.__version__)"): 0.7.0 - kafka-python version (
python -c "import kafka; print(kafka.__version__)"): 2.0.2 - Kafka Broker version (
kafka-topics.sh --version): 2.6.0 - Other information (Confluent Cloud version, etc.): none relevant
Reproducible example
async with AIOKafkaProducer(...) as producer:
producer.send(...)