當前位置: 首頁>>代碼示例>>Java>>正文


Java BrokerData.selectBrokerAddr方法代碼示例

本文整理匯總了Java中org.apache.rocketmq.common.protocol.route.BrokerData.selectBrokerAddr方法的典型用法代碼示例。如果您正苦於以下問題:Java BrokerData.selectBrokerAddr方法的具體用法?Java BrokerData.selectBrokerAddr怎麽用?Java BrokerData.selectBrokerAddr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.rocketmq.common.protocol.route.BrokerData的用法示例。


在下文中一共展示了BrokerData.selectBrokerAddr方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: examineTopicStats

import org.apache.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:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:21,代碼來源:DefaultMQAdminExtImpl.java

示例2: examineConsumeStats

import org.apache.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:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:26,代碼來源:DefaultMQAdminExtImpl.java

示例3: examineConsumerConnectionInfo

import org.apache.rocketmq.common.protocol.route.BrokerData; //導入方法依賴的package包/類
@Override
public ConsumerConnection examineConsumerConnectionInfo(String consumerGroup) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    ConsumerConnection result = new ConsumerConnection();
    String topic = MixAll.getRetryTopic(consumerGroup);
    List<BrokerData> brokers = this.examineTopicRouteInfo(topic).getBrokerDatas();
    BrokerData brokerData = brokers.get(random.nextInt(brokers.size()));
    String addr = null;
    if (brokerData != null) {
        addr = brokerData.selectBrokerAddr();
        if (StringUtils.isNotBlank(addr)) {
            result = this.mqClientInstance.getMQClientAPIImpl().getConsumerConnectionList(addr, consumerGroup, timeoutMillis);
        }
    }

    if (result.getConnectionSet().isEmpty()) {
        log.warn("the consumer group not online. brokerAddr={}, group={}", addr, consumerGroup);
        throw new MQClientException(ResponseCode.CONSUMER_NOT_ONLINE, "Not found the consumer group connection");
    }

    return result;
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:23,代碼來源:DefaultMQAdminExtImpl.java

示例4: examineProducerConnectionInfo

import org.apache.rocketmq.common.protocol.route.BrokerData; //導入方法依賴的package包/類
@Override
public ProducerConnection examineProducerConnectionInfo(String producerGroup, final String topic) throws RemotingException,
    MQClientException, InterruptedException, MQBrokerException {
    ProducerConnection result = new ProducerConnection();
    List<BrokerData> brokers = this.examineTopicRouteInfo(topic).getBrokerDatas();
    BrokerData brokerData = brokers.get(random.nextInt(brokers.size()));
    String addr = null;
    if (brokerData != null) {
        addr = brokerData.selectBrokerAddr();
        if (StringUtils.isNotBlank(addr)) {
            result = this.mqClientInstance.getMQClientAPIImpl().getProducerConnectionList(addr, producerGroup, timeoutMillis);
        }
    }

    if (result.getConnectionSet().isEmpty()) {
        log.warn("the producer group not online. brokerAddr={}, group={}", addr, producerGroup);
        throw new MQClientException("Not found the producer group connection", null);
    }

    return result;
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:22,代碼來源:DefaultMQAdminExtImpl.java

示例5: resetOffsetByTimestamp

import org.apache.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:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:21,代碼來源:DefaultMQAdminExtImpl.java

示例6: queryTopicConsumeByWho

import org.apache.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:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:17,代碼來源:DefaultMQAdminExtImpl.java

示例7: getConsumerRunningInfo

import org.apache.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:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:18,代碼來源:DefaultMQAdminExtImpl.java

示例8: examineTopicStats

import org.apache.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:apache,項目名稱:rocketmq,代碼行數:22,代碼來源:DefaultMQAdminExtImpl.java

示例9: examineConsumeStats

import org.apache.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:apache,項目名稱:rocketmq,代碼行數:27,代碼來源:DefaultMQAdminExtImpl.java

示例10: examineConsumerConnectionInfo

import org.apache.rocketmq.common.protocol.route.BrokerData; //導入方法依賴的package包/類
@Override
public ConsumerConnection examineConsumerConnectionInfo(
    String consumerGroup) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    ConsumerConnection result = new ConsumerConnection();
    String topic = MixAll.getRetryTopic(consumerGroup);
    List<BrokerData> brokers = this.examineTopicRouteInfo(topic).getBrokerDatas();
    BrokerData brokerData = brokers.get(random.nextInt(brokers.size()));
    String addr = null;
    if (brokerData != null) {
        addr = brokerData.selectBrokerAddr();
        if (StringUtils.isNotBlank(addr)) {
            result = this.mqClientInstance.getMQClientAPIImpl().getConsumerConnectionList(addr, consumerGroup, timeoutMillis);
        }
    }

    if (result.getConnectionSet().isEmpty()) {
        log.warn("the consumer group not online. brokerAddr={}, group={}", addr, consumerGroup);
        throw new MQClientException(ResponseCode.CONSUMER_NOT_ONLINE, "Not found the consumer group connection");
    }

    return result;
}
 
開發者ID:apache,項目名稱:rocketmq,代碼行數:24,代碼來源:DefaultMQAdminExtImpl.java

示例11: examineProducerConnectionInfo

import org.apache.rocketmq.common.protocol.route.BrokerData; //導入方法依賴的package包/類
@Override
public ProducerConnection examineProducerConnectionInfo(String producerGroup,
    final String topic) throws RemotingException,
    MQClientException, InterruptedException, MQBrokerException {
    ProducerConnection result = new ProducerConnection();
    List<BrokerData> brokers = this.examineTopicRouteInfo(topic).getBrokerDatas();
    BrokerData brokerData = brokers.get(random.nextInt(brokers.size()));
    String addr = null;
    if (brokerData != null) {
        addr = brokerData.selectBrokerAddr();
        if (StringUtils.isNotBlank(addr)) {
            result = this.mqClientInstance.getMQClientAPIImpl().getProducerConnectionList(addr, producerGroup, timeoutMillis);
        }
    }

    if (result.getConnectionSet().isEmpty()) {
        log.warn("the producer group not online. brokerAddr={}, group={}", addr, producerGroup);
        throw new MQClientException("Not found the producer group connection", null);
    }

    return result;
}
 
開發者ID:apache,項目名稱:rocketmq,代碼行數:23,代碼來源:DefaultMQAdminExtImpl.java

示例12: resetOffsetByTimestamp

import org.apache.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:apache,項目名稱:rocketmq,代碼行數:22,代碼來源:DefaultMQAdminExtImpl.java

示例13: queryTopicConsumeByWho

import org.apache.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:apache,項目名稱:rocketmq,代碼行數:18,代碼來源:DefaultMQAdminExtImpl.java

示例14: getConsumerRunningInfo

import org.apache.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:apache,項目名稱:rocketmq,代碼行數:19,代碼來源:DefaultMQAdminExtImpl.java

示例15: queryConsumeTimeSpan

import org.apache.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(), 3000));
    }

    return queueTimeSpan;
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:12,代碼來源:DefaultMQPushConsumerImpl.java


注:本文中的org.apache.rocketmq.common.protocol.route.BrokerData.selectBrokerAddr方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。