Hi all, I have a Kafka cluster with 3 nodes,
props.put("bootstrap.servers", "node1:9092, node2:9092, node3:9092") as I known, when a producer is created by new KafkaProducer(props) and wants to send a message, it will first choose a broker in the list [node1,node2,node3], connect with it and request the metadata. BUT, when the chosen broker is unavailable, the producer will blocked for metadata.fetch.timeout.ms, default 60,000ms, and then throw a TimeoutException: Failed to update metadata after 60000 ms. when setting props.put("bootstrap.servers", "node1:9092, node2:9092, node3:9092"), but node2 is dead, OR setting props.put("bootstrap.servers", "node1:9092, node5:9092"),(node5 dose not exist) one broker node1 is enough, I add some wrong brokers. There are chances that the producer chooses an unavailable(dead/not exists) broker to request metadata, and get a Exception. Why wouldn't the producer try to get metadata from other brokers ? The producer called waitOnMetadata, and wake up the sender, what happened next? In which Java file can I find related source codes? Thank you for your attention! Best regards!