当前位置: 首页>>代码示例>>Java>>正文


Java BrokerData.getBrokerName方法代码示例

本文整理汇总了Java中com.alibaba.rocketmq.common.protocol.route.BrokerData.getBrokerName方法的典型用法代码示例。如果您正苦于以下问题:Java BrokerData.getBrokerName方法的具体用法?Java BrokerData.getBrokerName怎么用?Java BrokerData.getBrokerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.rocketmq.common.protocol.route.BrokerData的用法示例。


在下文中一共展示了BrokerData.getBrokerName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTopicClusterList

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public Set<String> getTopicClusterList(final String topic) throws InterruptedException, MQBrokerException, MQClientException, RemotingException{
    Set<String> clusterSet = new HashSet<String>();
    ClusterInfo clusterInfo = examineBrokerClusterInfo();
    TopicRouteData topicRouteData = examineTopicRouteInfo(topic);
    BrokerData brokerData = topicRouteData.getBrokerDatas().get(0);
    String brokerName = brokerData.getBrokerName();
    Iterator<Map.Entry<String, Set<String>>> it = clusterInfo.getClusterAddrTable().entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry<String, Set<String>> next = it.next();
        if (next.getValue().contains(brokerName)) {
            clusterSet.add(next.getKey());
        }
    }
    return clusterSet;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:17,代码来源:DefaultMQAdminExtImpl.java

示例2: findTopicBelongToWhichCluster

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
private String findTopicBelongToWhichCluster(final String topic, final ClusterInfo clusterInfo,
        final DefaultMQAdminExt defaultMQAdminExt) throws RemotingException, MQClientException,
        InterruptedException {
    TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic);

    BrokerData brokerData = topicRouteData.getBrokerDatas().get(0);

    String brokerName = brokerData.getBrokerName();

    Iterator<Entry<String, Set<String>>> it = clusterInfo.getClusterAddrTable().entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, Set<String>> next = it.next();
        if (next.getValue().contains(brokerName)) {
            return next.getKey();
        }
    }

    return null;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:20,代码来源:TopicListSubCommand.java


注:本文中的com.alibaba.rocketmq.common.protocol.route.BrokerData.getBrokerName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。