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


Java BrokerData.selectBrokerAddr方法代码示例

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


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

示例1: examineTopicStats

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public TopicStatsTable examineTopicStats(String topic) throws RemotingException, MQClientException, InterruptedException,
        MQBrokerException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    TopicStatsTable topicStatsTable = new TopicStatsTable();

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            TopicStatsTable tst = this.mqClientInstance.getMQClientAPIImpl().getTopicStatsInfo(addr, topic, timeoutMillis);
            topicStatsTable.getOffsetTable().putAll(tst.getOffsetTable());
        }
    }

    if (topicStatsTable.getOffsetTable().isEmpty()) {
        throw new MQClientException("Not found the topic stats info", null);
    }

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

示例2: examineConsumeStats

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public ConsumeStats examineConsumeStats(String consumerGroup, String topic) throws RemotingException, MQClientException,
        InterruptedException, MQBrokerException {
    String retryTopic = MixAll.getRetryTopic(consumerGroup);
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(retryTopic);
    ConsumeStats result = new ConsumeStats();

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            ConsumeStats consumeStats =
                    this.mqClientInstance.getMQClientAPIImpl().getConsumeStats(addr, consumerGroup, topic, timeoutMillis * 3);
            result.getOffsetTable().putAll(consumeStats.getOffsetTable());
            double value = result.getConsumeTps() + consumeStats.getConsumeTps();
            result.setConsumeTps(value);
        }
    }

    if (result.getOffsetTable().isEmpty()) {
        throw new MQClientException(ResponseCode.CONSUMER_NOT_ONLINE,
            "Not found the consumer group consume stats, because return offset table is empty, maybe the consumer not consume any message");
    }

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

示例3: examineConsumerConnectionInfo

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public ConsumerConnection examineConsumerConnectionInfo(String consumerGroup) throws InterruptedException, MQBrokerException,
        RemotingException, MQClientException {
    String topic = MixAll.getRetryTopic(consumerGroup);
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    ConsumerConnection result = new ConsumerConnection();

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            return this.mqClientInstance.getMQClientAPIImpl().getConsumerConnectionList(addr, consumerGroup, timeoutMillis);
        }
    }

    if (result.getConnectionSet().isEmpty()) {
        throw new MQClientException(ResponseCode.CONSUMER_NOT_ONLINE, "Not found the consumer group connection");
    }

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

示例4: examineProducerConnectionInfo

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public ProducerConnection examineProducerConnectionInfo(String producerGroup, final String topic) throws RemotingException,
        MQClientException, InterruptedException, MQBrokerException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    ProducerConnection result = new ProducerConnection();

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            return this.mqClientInstance.getMQClientAPIImpl().getProducerConnectionList(addr, producerGroup, timeoutMillis);
        }
    }

    if (result.getConnectionSet().isEmpty()) {
        throw new MQClientException("Not found the consumer group connection", null);
    }

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

示例5: resetOffsetByTimestamp

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
public Map<MessageQueue, Long> resetOffsetByTimestamp(String topic, String group, long timestamp, boolean isForce, boolean isC)
        throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    List<BrokerData> brokerDatas = topicRouteData.getBrokerDatas();
    Map<MessageQueue, Long> allOffsetTable = new HashMap<MessageQueue, Long>();
    if (brokerDatas != null) {
        for (BrokerData brokerData : brokerDatas) {
            String addr = brokerData.selectBrokerAddr();
            if (addr != null) {
                Map<MessageQueue, Long> offsetTable =
                        this.mqClientInstance.getMQClientAPIImpl().invokeBrokerToResetOffset(addr, topic, group, timestamp, isForce,
                            timeoutMillis, isC);
                if (offsetTable != null) {
                    allOffsetTable.putAll(offsetTable);
                }
            }
        }
    }
    return allOffsetTable;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:21,代码来源:DefaultMQAdminExtImpl.java

示例6: queryTopicConsumeByWho

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public GroupList queryTopicConsumeByWho(String topic) throws InterruptedException, MQBrokerException, RemotingException,
        MQClientException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            return this.mqClientInstance.getMQClientAPIImpl().queryTopicConsumeByWho(addr, topic, timeoutMillis);
        }

        break;
    }

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

示例7: getConsumerRunningInfo

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public ConsumerRunningInfo getConsumerRunningInfo(String consumerGroup, String clientId, boolean jstack) throws RemotingException,
        MQClientException, InterruptedException {
    String topic = MixAll.RETRY_GROUP_TOPIC_PREFIX + consumerGroup;
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    List<BrokerData> brokerDatas = topicRouteData.getBrokerDatas();
    if (brokerDatas != null) {
        for (BrokerData brokerData : brokerDatas) {
            String addr = brokerData.selectBrokerAddr();
            if (addr != null) {
                return this.mqClientInstance.getMQClientAPIImpl().getConsumerRunningInfo(addr, consumerGroup, clientId, jstack,
                    timeoutMillis * 3);
            }
        }
    }
    return null;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:18,代码来源:DefaultMQAdminExtImpl.java

示例8: examineTopicStats

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public TopicStatsTable examineTopicStats(String topic) throws RemotingException, MQClientException,
        InterruptedException, MQBrokerException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    TopicStatsTable topicStatsTable = new TopicStatsTable();

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            TopicStatsTable tst =
                    this.mQClientFactory.getMQClientAPIImpl().getTopicStatsInfo(addr, topic, 3000);
            topicStatsTable.getOffsetTable().putAll(tst.getOffsetTable());
        }
    }

    if (topicStatsTable.getOffsetTable().isEmpty()) {
        throw new MQClientException("Not found the topic stats info", null);
    }

    return topicStatsTable;
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:22,代码来源:DefaultMQAdminExtImpl.java

示例9: examineConsumerConnectionInfo

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public ConsumerConnection examineConsumerConnectionInfo(String consumerGroup)
        throws InterruptedException, MQBrokerException, RemotingException, MQClientException {
    String topic = MixAll.getRetryTopic(consumerGroup);
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    ConsumerConnection result = new ConsumerConnection();

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            return this.mQClientFactory.getMQClientAPIImpl().getConsumerConnectionList(addr,
                consumerGroup, 3000);
        }
    }

    if (result.getConnectionSet().isEmpty()) {
        throw new MQClientException("Not found the consumer group connection", null);
    }

    return result;
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:22,代码来源:DefaultMQAdminExtImpl.java

示例10: examineProducerConnectionInfo

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public ProducerConnection examineProducerConnectionInfo(String producerGroup, final String topic)
        throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    ProducerConnection result = new ProducerConnection();

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            return this.mQClientFactory.getMQClientAPIImpl().getProducerConnectionList(addr,
                producerGroup, 300);
        }
    }

    if (result.getConnectionSet().isEmpty()) {
        throw new MQClientException("Not found the consumer group connection", null);
    }

    return result;
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:21,代码来源:DefaultMQAdminExtImpl.java

示例11: queryTopicConsumeByWho

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public GroupList queryTopicConsumeByWho(String topic) throws InterruptedException, MQBrokerException,
        RemotingException, MQClientException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            return this.mQClientFactory.getMQClientAPIImpl().queryTopicConsumeByWho(addr, topic, 3000);
        }

        break;
    }

    return null;
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:17,代码来源:DefaultMQAdminExtImpl.java

示例12: queryConsumeTimeSpan

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic) throws RemotingException,
        MQClientException, InterruptedException, MQBrokerException {
    List<QueueTimeSpan> queueTimeSpan = new ArrayList<QueueTimeSpan>();
    TopicRouteData routeData =
            this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, 3000);
    for (BrokerData brokerData : routeData.getBrokerDatas()) {
        String addr = brokerData.selectBrokerAddr();
        queueTimeSpan.addAll(this.mQClientFactory.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic,
                groupName(), 3000l));
    }

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

示例13: findBrokerAddrByTopic

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
public String findBrokerAddrByTopic(final String topic) {
    TopicRouteData topicRouteData = this.topicRouteTable.get(topic);
    if (topicRouteData != null) {
        List<BrokerData> brokers = topicRouteData.getBrokerDatas();
        if (!brokers.isEmpty()) {
            BrokerData bd = brokers.get(0);
            return bd.selectBrokerAddr();
        }
    }

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

示例14: queryConsumeTimeSpan

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic, final String group) throws InterruptedException, MQBrokerException,
        RemotingException, MQClientException {
    List<QueueTimeSpan> spanSet = new ArrayList<QueueTimeSpan>();
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            spanSet.addAll(this.mqClientInstance.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, group, timeoutMillis));
        }
    }
    return spanSet;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:14,代码来源:DefaultMQAdminExtImpl.java

示例15: cloneGroupOffset

import com.alibaba.rocketmq.common.protocol.route.BrokerData; //导入方法依赖的package包/类
@Override
public void cloneGroupOffset(String srcGroup, String destGroup, String topic, boolean isOffline) throws RemotingException,
        MQClientException, InterruptedException, MQBrokerException {
    String retryTopic = MixAll.getRetryTopic(srcGroup);
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(retryTopic);

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            this.mqClientInstance.getMQClientAPIImpl().cloneGroupOffset(addr, srcGroup, destGroup, topic, isOffline, timeoutMillis * 3);
        }
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:14,代码来源:DefaultMQAdminExtImpl.java


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