I'm writing a producer in go, using the channel producer example of confluent-kafka-go library. When I run my app with brokers working then I get the produced events by reading from range producer.Events()
.
But when the brokers are down, I get logs like the following from the kafka library printed in stderr, but I cannot find a way for my app to register for those errors so I can detect them:
%3|1528267290.204|FAIL|rdkafka#producer-1| [thrd:xxx.xxx.com:9092/bootstrap]: xxx.xxx.com:9092/bootstrap: Connect to ipv4#xxx.xxx.xxx.xxx:9092 failed: Connection refused
%3|1528267290.204|ERROR|rdkafka#producer-1| [thrd:xxx.xxx.com:9092/bootstrap]: 1/1 brokers are down
How can I receive those events from the library ? To clarify I'm interested in errors like RD_KAFKA_RESP_ERR__FAIL described in the docs