public Node getRouteOutNode(String topicName, int partition, ClientIdMetadata clientId) {
        String clientRack = clientId.rack();
        if (clientRack == null) {
            throw new IllegalArgumentException("[BUG] The client rack must be set");
        }

        BrokerRegistration target = metadataCache.getPartitionLeaderNode(topicName, partition);
        if (target == null) {
            return currentNode;
        }
        Map<String, Map<Integer, BrokerRegistration>> main2proxyByRack = this.main2proxyByRack;
        if (Objects.equals(clientRack, currentRack)) {
            if (target.id() == currentNode.id()) {
                return currentNode;
            } else {
                if (Objects.equals(target.rack().orElse(null), currentRack)) {
                    // The producer should refresh metadata and send to another node in the same rack as the producer
                    return Node.noNode();
                } else {
                    // Check whether the current node should proxy the target
                    Map<Integer, BrokerRegistration> main2proxy = main2proxyByRack.get(currentRack);
                    if (main2proxy == null) {
                        // The current node is the last node in the rack, and the current node is shutting down.
                        return Node.noNode();
                    }
                    BrokerRegistration proxyNode = main2proxy.get(target.id());
                    if (proxyNode != null && proxyNode.id() == currentNode.id()) {
                        // Get the target main node.
                        return target.node(interBrokerListenerName).orElse(currentNode);
                    } else {
                        // The producer should refresh metadata and send to another node in the same rack as the current node.
                        return Node.noNode();
                    }

                }
            }
        } else {
            if (main2proxyByRack.containsKey(clientRack)) {
                // The producer should send records to the nodes with the same rack.
                return Node.noNode();
            } else {
                MismatchRecorder.instance().record(topicName, clientId);
                // The cluster doesn't cover the client rack, the producer should directly send records to the partition main node.
                if (target.id() == currentNode.id()) {
                    return currentNode;
                } else {
                    return Node.noNode();
                }
            }
        }
    }
Get route out node to split the produce request.
<p>
If return Node.noNode, it means the producer should refresh metadata and send to another node, {@link RouterOut} will return NOT_LEADER_OR_FOLLOWER.
core/src/main/java/kafka/automq/zerozone/ProxyNodeMapping.java