Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


The solution is that we can provide one method for metadata fetch into Producer.  When the application restarted/started, it can call it before mark the application is ready for handle requests.  So, when the first request/record be handled. the metadata had been fetched so that it's handle's speed will be much faster.

Code Block
public Cluster getCluster(String topic, long maxBlockTimeMs) {
        Objects.requireNonNull(topic, "topic cannot be null");
        try {
            return waitOnMetadata(topic, null, time.milliseconds(), maxBlockTimeMs).cluster;
        } catch (InterruptedException e) {
            throw new InterruptException(e);