@Override
    public Map<String, List<Partition>> roundRobinAssignment(List<Partition> partitions,
            List<String> consumers) {
        if (partitions.isEmpty() || consumers.isEmpty()) {
            return null;
        }
        Map<String, List<Partition>> assignments = new TreeMap<>();
        int numPartitions = partitions.size();
        int numServers = consumers.size();
        int max = (int) Math.ceil((float) numPartitions / numServers);
        int serverIdx = 0;
        if (numServers > 1) {
            serverIdx = RANDOM.nextInt(numServers);
        }
        int partitionIdx = 0;
        for (int j = 0; j < numServers; j++) {
            String server = consumers.get((j + serverIdx) % numServers);
            List<Partition> serverPartitions = new ArrayList<>(max);
            for (int i = partitionIdx; i < numPartitions; i += numServers) {
                serverPartitions.add(partitions.get(i % numPartitions));
            }
            assignments.put(server, serverPartitions);
            partitionIdx++;
        }
        return assignments;
    }
Round robin assign partitions

@param partitions
@param consumers
@return
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/balance/DefaultLoadBalancer.java