-
Bug
-
Resolution: Unresolved
-
Normal
-
None
Error message:
Connect attempt to <kafka.conn.BrokerConnection object at 0x7f5e9e938370> returned error 111. Disconnecting.
Currently, the Kafka producer (self.producer = KafkaProducer(**settings.KAFKA_AUTH)) lacks proper error handling and logging. To improve stability and observability, the following enhancements should be made:
- Add Try-Catch Block:
-
- Wrap the Kafka producer initialization in a try-except block to handle potential connection failures or misconfigurations.
- Ensure appropriate error messages are logged when an exception occurs.
- Enable Retry Logic:
-
- it looks that KafkaProducer support retry logic, we need to enable it.