kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Wikström <Daniel.Wikst...@tradedoubler.com>
Subject In-Reply-To=%3CCALsq4vKokx2_haKCwXHdoHrsVwn8UoBETCco6o1dwyFDoed1aw%40mail.gmail.com%3E&Subject=TimeoutException%3A%20failed%20to%20update%20metadata%20after
Date Wed, 26 Oct 2016 09:39:40 GMT
The KafkaProducer have a method partitionsFor() that fetches the metadata. So something like
this can be used to force load the metadata with max.block.ms=0


while(!gotMetadata) {
    try {
        producer.partitionsFor(topic);
        gotMetadata=true;

    } catch (TimeoutException e) {
        logger.info(String.format("KafkaProducer for topic %s is waiting for metadata...",
topic));
        try {
            Thread.sleep(100);
        } catch (InterruptedException ignored) {

        }
    }
}


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message