The Confluent Kafka library (python version in this case) has a produce method which takes a delivery callback function:
kafka_producer.produce(topic=topic,
key=key,
value=value,
on_delivery=delivery_callback)
This callback is called whether the message was successfully delivered or not:
def delivery_callback(err, msg):
I want to know what are the scenarios when this delivery callback is called with an error? I tried to shut down the kafka broker server and then produce and flush the message. Still the callback was not called with the error, rather the next time I did flush with the Kafka broker running, the successful delivery callback for the previous message came first.
So how can I have error callback?