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


Java TopicList類代碼示例

本文整理匯總了Java中org.apache.rocketmq.common.protocol.body.TopicList的典型用法代碼示例。如果您正苦於以下問題:Java TopicList類的具體用法?Java TopicList怎麽用?Java TopicList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getTopicListFromNameServer

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public TopicList getTopicListFromNameServer(final long timeoutMillis)
    throws RemotingException, MQClientException, InterruptedException {
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_LIST_FROM_NAMESERVER, null);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                return TopicList.decode(body, TopicList.class);
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:20,代碼來源:MQClientAPIImpl.java

示例2: getTopicsByCluster

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public TopicList getTopicsByCluster(final String cluster, final long timeoutMillis)
    throws RemotingException, MQClientException, InterruptedException {
    GetTopicsByClusterRequestHeader requestHeader = new GetTopicsByClusterRequestHeader();
    requestHeader.setCluster(cluster);
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_TOPICS_BY_CLUSTER, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                TopicList topicList = TopicList.decode(body, TopicList.class);
                return topicList;
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:23,代碼來源:MQClientAPIImpl.java

示例3: getSystemTopicList

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public TopicList getSystemTopicList(final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_SYSTEM_TOPIC_LIST_FROM_NS, null);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                TopicList topicList = TopicList.decode(response.getBody(), TopicList.class);
                if (topicList.getTopicList() != null && !topicList.getTopicList().isEmpty()
                    && !UtilAll.isBlank(topicList.getBrokerAddr())) {
                    TopicList tmp = getSystemTopicListFromBroker(topicList.getBrokerAddr(), timeoutMillis);
                    if (tmp.getTopicList() != null && !tmp.getTopicList().isEmpty()) {
                        topicList.getTopicList().addAll(tmp.getTopicList());
                    }
                }
                return topicList;
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:27,代碼來源:MQClientAPIImpl.java

示例4: getSystemTopicListFromBroker

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public TopicList getSystemTopicListFromBroker(final String addr, final long timeoutMillis)
    throws RemotingException, MQClientException, InterruptedException {
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_SYSTEM_TOPIC_LIST_FROM_BROKER, null);

    RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr),
        request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                TopicList topicList = TopicList.decode(body, TopicList.class);
                return topicList;
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:22,代碼來源:MQClientAPIImpl.java

示例5: getUnitTopics

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public byte[] getUnitTopics() {
    TopicList topicList = new TopicList();
    try {
        try {
            this.lock.readLock().lockInterruptibly();
            Iterator<Entry<String, List<QueueData>>> topicTableIt =
                this.topicQueueTable.entrySet().iterator();
            while (topicTableIt.hasNext()) {
                Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
                String topic = topicEntry.getKey();
                List<QueueData> queueDatas = topicEntry.getValue();
                if (queueDatas != null && queueDatas.size() > 0
                    && TopicSysFlag.hasUnitFlag(queueDatas.get(0).getTopicSynFlag())) {
                    topicList.getTopicList().add(topic);
                }
            }
        } finally {
            this.lock.readLock().unlock();
        }
    } catch (Exception e) {
        log.error("getAllTopicList Exception", e);
    }

    return topicList.encode();
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:26,代碼來源:RouteInfoManager.java

示例6: getHasUnitSubTopicList

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public byte[] getHasUnitSubTopicList() {
    TopicList topicList = new TopicList();
    try {
        try {
            this.lock.readLock().lockInterruptibly();
            Iterator<Entry<String, List<QueueData>>> topicTableIt =
                this.topicQueueTable.entrySet().iterator();
            while (topicTableIt.hasNext()) {
                Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
                String topic = topicEntry.getKey();
                List<QueueData> queueDatas = topicEntry.getValue();
                if (queueDatas != null && queueDatas.size() > 0
                    && TopicSysFlag.hasUnitSubFlag(queueDatas.get(0).getTopicSynFlag())) {
                    topicList.getTopicList().add(topic);
                }
            }
        } finally {
            this.lock.readLock().unlock();
        }
    } catch (Exception e) {
        log.error("getAllTopicList Exception", e);
    }

    return topicList.encode();
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:26,代碼來源:RouteInfoManager.java

示例7: getHasUnitSubUnUnitTopicList

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public byte[] getHasUnitSubUnUnitTopicList() {
    TopicList topicList = new TopicList();
    try {
        try {
            this.lock.readLock().lockInterruptibly();
            Iterator<Entry<String, List<QueueData>>> topicTableIt =
                this.topicQueueTable.entrySet().iterator();
            while (topicTableIt.hasNext()) {
                Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
                String topic = topicEntry.getKey();
                List<QueueData> queueDatas = topicEntry.getValue();
                if (queueDatas != null && queueDatas.size() > 0
                    && !TopicSysFlag.hasUnitFlag(queueDatas.get(0).getTopicSynFlag())
                    && TopicSysFlag.hasUnitSubFlag(queueDatas.get(0).getTopicSynFlag())) {
                    topicList.getTopicList().add(topic);
                }
            }
        } finally {
            this.lock.readLock().unlock();
        }
    } catch (Exception e) {
        log.error("getAllTopicList Exception", e);
    }

    return topicList.encode();
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:27,代碼來源:RouteInfoManager.java

示例8: getUnitTopicList

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public TopicList getUnitTopicList(final boolean containRetry, final long timeoutMillis)
    throws RemotingException, MQClientException, InterruptedException {
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_UNIT_TOPIC_LIST, null);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                TopicList topicList = TopicList.decode(response.getBody(), TopicList.class);
                if (!containRetry) {
                    Iterator<String> it = topicList.getTopicList().iterator();
                    while (it.hasNext()) {
                        String topic = it.next();
                        if (topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX))
                            it.remove();
                    }
                }

                return topicList;
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:30,代碼來源:MQClientAPIImpl.java

示例9: getHasUnitSubTopicList

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public TopicList getHasUnitSubTopicList(final boolean containRetry, final long timeoutMillis)
    throws RemotingException, MQClientException, InterruptedException {
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_HAS_UNIT_SUB_TOPIC_LIST, null);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                TopicList topicList = TopicList.decode(response.getBody(), TopicList.class);
                if (!containRetry) {
                    Iterator<String> it = topicList.getTopicList().iterator();
                    while (it.hasNext()) {
                        String topic = it.next();
                        if (topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX))
                            it.remove();
                    }
                }
                return topicList;
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:29,代碼來源:MQClientAPIImpl.java

示例10: getHasUnitSubUnUnitTopicList

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public TopicList getHasUnitSubUnUnitTopicList(final boolean containRetry, final long timeoutMillis)
    throws RemotingException, MQClientException, InterruptedException {
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_HAS_UNIT_SUB_UNUNIT_TOPIC_LIST, null);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                TopicList topicList = TopicList.decode(response.getBody(), TopicList.class);
                if (!containRetry) {
                    Iterator<String> it = topicList.getTopicList().iterator();
                    while (it.hasNext()) {
                        String topic = it.next();
                        if (topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX))
                            it.remove();
                    }
                }
                return topicList;
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:29,代碼來源:MQClientAPIImpl.java

示例11: getSystemTopicListFromBroker

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
private RemotingCommand getSystemTopicListFromBroker(ChannelHandlerContext ctx, RemotingCommand request)
    throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);

    Set<String> topics = this.brokerController.getTopicConfigManager().getSystemTopic();
    TopicList topicList = new TopicList();
    topicList.setTopicList(topics);
    response.setBody(topicList.encode());
    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:13,代碼來源:AdminBrokerProcessor.java

示例12: getAllTopicList

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public byte[] getAllTopicList() {
    TopicList topicList = new TopicList();
    try {
        try {
            this.lock.readLock().lockInterruptibly();
            topicList.getTopicList().addAll(this.topicQueueTable.keySet());
        } finally {
            this.lock.readLock().unlock();
        }
    } catch (Exception e) {
        log.error("getAllTopicList Exception", e);
    }

    return topicList.encode();
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:16,代碼來源:RouteInfoManager.java

示例13: getSystemTopicList

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public byte[] getSystemTopicList() {
    TopicList topicList = new TopicList();
    try {
        try {
            this.lock.readLock().lockInterruptibly();
            for (Map.Entry<String, Set<String>> entry : clusterAddrTable.entrySet()) {
                topicList.getTopicList().add(entry.getKey());
                topicList.getTopicList().addAll(entry.getValue());
            }

            if (brokerAddrTable != null && !brokerAddrTable.isEmpty()) {
                Iterator<String> it = brokerAddrTable.keySet().iterator();
                while (it.hasNext()) {
                    BrokerData bd = brokerAddrTable.get(it.next());
                    HashMap<Long, String> brokerAddrs = bd.getBrokerAddrs();
                    if (brokerAddrs != null && !brokerAddrs.isEmpty()) {
                        Iterator<Long> it2 = brokerAddrs.keySet().iterator();
                        topicList.setBrokerAddr(brokerAddrs.get(it2.next()));
                        break;
                    }
                }
            }
        } finally {
            this.lock.readLock().unlock();
        }
    } catch (Exception e) {
        log.error("getAllTopicList Exception", e);
    }

    return topicList.encode();
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:32,代碼來源:RouteInfoManager.java

示例14: getTopicsByCluster

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public byte[] getTopicsByCluster(String cluster) {
    TopicList topicList = new TopicList();
    try {
        try {
            this.lock.readLock().lockInterruptibly();
            Set<String> brokerNameSet = this.clusterAddrTable.get(cluster);
            for (String brokerName : brokerNameSet) {
                Iterator<Entry<String, List<QueueData>>> topicTableIt =
                    this.topicQueueTable.entrySet().iterator();
                while (topicTableIt.hasNext()) {
                    Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
                    String topic = topicEntry.getKey();
                    List<QueueData> queueDatas = topicEntry.getValue();
                    for (QueueData queueData : queueDatas) {
                        if (brokerName.equals(queueData.getBrokerName())) {
                            topicList.getTopicList().add(topic);
                            break;
                        }
                    }
                }
            }
        } finally {
            this.lock.readLock().unlock();
        }
    } catch (Exception e) {
        log.error("getAllTopicList Exception", e);
    }

    return topicList.encode();
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:31,代碼來源:RouteInfoManager.java

示例15: getSystemTopicList

import org.apache.rocketmq.common.protocol.body.TopicList; //導入依賴的package包/類
public TopicList getSystemTopicList(
    final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_SYSTEM_TOPIC_LIST_FROM_NS, null);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                TopicList topicList = TopicList.decode(response.getBody(), TopicList.class);
                if (topicList.getTopicList() != null && !topicList.getTopicList().isEmpty()
                    && !UtilAll.isBlank(topicList.getBrokerAddr())) {
                    TopicList tmp = getSystemTopicListFromBroker(topicList.getBrokerAddr(), timeoutMillis);
                    if (tmp.getTopicList() != null && !tmp.getTopicList().isEmpty()) {
                        topicList.getTopicList().addAll(tmp.getTopicList());
                    }
                }
                return topicList;
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
開發者ID:apache,項目名稱:rocketmq,代碼行數:28,代碼來源:MQClientAPIImpl.java


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