public int replicationHops(String upstreamClusterAlias) throws InterruptedException {
        return heartbeatTopics().stream()
            .map(x -> countHopsForTopic(x, upstreamClusterAlias))
            .filter(x -> x != -1)
            .mapToInt(x -> x)
            .min()
            .orElse(-1);
    }
Computes the shortest number of hops from an upstream source cluster.
For example, given replication flow A-&gt;B-&gt;C, there are two hops from A to C.
Returns -1 if the upstream cluster is unreachable.
connect/mirror-client/src/main/java/org/apache/kafka/connect/mirror/MirrorClient.java