@Override
    public List<PartitionInfo> partitionsFor(String topic) {
        Objects.requireNonNull(topic, "topic cannot be null");
        try {
            return waitOnMetadata(topic, null, time.milliseconds(), maxBlockTimeMs).cluster.partitionsForTopic(topic);
        } catch (InterruptedException e) {
            throw new InterruptException(e);
        }
    }
Get the partition metadata for the given topic. This can be used for custom partitioning.
@throws AuthenticationException if authentication fails. See the exception for more details
@throws AuthorizationException if not authorized to the specified topic. See the exception for more details
@throws InterruptException if the thread is interrupted while blocked
@throws TimeoutException if metadata could not be refreshed within {@code max.block.ms}
@throws KafkaException for all Kafka-related exceptions, including the case where this method is called after producer close
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java