@Override
    public TubeMQResult cloneBrokersWithTopic(CloneBrokersReq req) throws Exception {

        int clusterId = req.getClusterId();
        // 1. query source broker config
        QueryBrokerCfgReq queryReq = QueryBrokerCfgReq.getReq(req.getSourceBrokerId());
        MasterEntry masterEntry = masterService.getMasterNode(Long.valueOf(clusterId));

        // 2. use source broker config to clone brokers
        AddBrokersReq addBrokersReq = getBatchAddBrokersReq(req, clusterId, req.getSourceBroker());

        // 3. request master, return broker ids generated by master
        AddBrokerResult addBrokerResult = addBrokersToClusterWithId(addBrokersReq, masterEntry);

        // might have duplicate brokers
        if (addBrokerResult.getErrCode() != TubeConst.SUCCESS_CODE) {
            return TubeMQResult.errorResult(addBrokerResult.getErrMsg());
        }
        List<Integer> brokerIds = getBrokerIds(addBrokerResult);
        List<AddTopicReq> addTopicReqs = req.getAddTopicReqs();

        // 4. add topic to brokers
        return addTopicsToBrokers(masterEntry, brokerIds, addTopicReqs);
    }
clone source broker to generate brokers with the same config and copy the topics in it.

@param req
@return

@throws Exception exception
inlong-tubemq/tubemq-manager/src/main/java/org/apache/inlong/tubemq/manager/service/NodeServiceImpl.java