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


Java TopicList类代码示例

本文整理汇总了Java中com.alibaba.rocketmq.common.protocol.body.TopicList的典型用法代码示例。如果您正苦于以下问题:Java TopicList类的具体用法?Java TopicList怎么用?Java TopicList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getAllTopicList

import com.alibaba.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:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:18,代码来源:RouteInfoManager.java

示例2: fetchAllTopicList

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
@Override
public TopicList fetchAllTopicList() {
    try {
        TopicList topicList = mqAdminExt.fetchAllTopicList();
        topicList.setTopicList(Sets.newHashSet(Iterables.filter(topicList.getTopicList(), new Predicate<String>() {
            @Override
            public boolean apply(String s) {
                return !(s.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX) || s.startsWith(MixAll.DLQ_GROUP_TOPIC_PREFIX)); // todo 暂时先过滤掉 以后再搞出来
            }
        })));
        return topicList;

    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:17,代码来源:TopicServiceImpl.java

示例3: getUnitTopics

import com.alibaba.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:medusar,项目名称:rocketmq-commet,代码行数:26,代码来源:RouteInfoManager.java

示例4: getHasUnitSubTopicList

import com.alibaba.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:medusar,项目名称:rocketmq-commet,代码行数:26,代码来源:RouteInfoManager.java

示例5: getHasUnitSubUnUnitTopicList

import com.alibaba.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:medusar,项目名称:rocketmq-commet,代码行数:27,代码来源:RouteInfoManager.java

示例6: execute

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
@Override
public void execute(final CommandLine commandLine, final Options options) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        TopicList topicList = defaultMQAdminExt.fetchAllTopicList();
        for (String topic : topicList.getTopicList()) {
            System.out.println(topic);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:22,代码来源:TopicListSubCommand.java

示例7: getSystemTopicList

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
public byte[] getSystemTopicList() {
    TopicList topicList = new TopicList();
    try {
        try {
            this.lock.readLock().lockInterruptibly();
            for (String cluster : clusterAddrTable.keySet()) {
                topicList.getTopicList().add(cluster);
                topicList.getTopicList().addAll(this.clusterAddrTable.get(cluster));
            }

            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 (bd.getBrokerAddrs() != null && !bd.getBrokerAddrs().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:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:34,代码来源:RouteInfoManager.java

示例8: getTopicsByCluster

import com.alibaba.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:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:33,代码来源:RouteInfoManager.java

示例9: getUnitTopics

import com.alibaba.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:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:28,代码来源:RouteInfoManager.java

示例10: getHasUnitSubTopicList

import com.alibaba.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:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:28,代码来源:RouteInfoManager.java

示例11: getHasUnitSubUnUnitTopicList

import com.alibaba.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:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:29,代码来源:RouteInfoManager.java

示例12: getAllTopicList

import com.alibaba.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:medusar,项目名称:rocketmq-commet,代码行数:16,代码来源:RouteInfoManager.java

示例13: getSystemTopicList

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
public byte[] getSystemTopicList() {
    TopicList topicList = new TopicList();
    try {
        try {
            this.lock.readLock().lockInterruptibly();
            for (String cluster : clusterAddrTable.keySet()) {
                topicList.getTopicList().add(cluster);
                topicList.getTopicList().addAll(this.clusterAddrTable.get(cluster));
            }

            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 (bd.getBrokerAddrs() != null && !bd.getBrokerAddrs().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:medusar,项目名称:rocketmq-commet,代码行数:32,代码来源:RouteInfoManager.java

示例14: getTopicsByCluster

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
/**
 * 获取集群下的Topic
 * Topic:BrokerName = 1:n
 * 所以需要先根据cluster查找到brokerName
 *
 * @param cluster
 * @return
 */
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:medusar,项目名称:rocketmq-commet,代码行数:41,代码来源:RouteInfoManager.java

示例15: getTopicListFromNameServer

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
/**
 * Name Server: 从Name Server获取所有Topic列表
 */
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) {
            TopicList topicList = TopicList.decode(body, TopicList.class);

            if (!UtilAll.isBlank(projectGroupPrefix)) {
                HashSet<String> newTopicSet = new HashSet<String>();
                for (String topic : topicList.getTopicList()) {
                    newTopicSet.add(VirtualEnvUtil.clearProjectGroup(topic, projectGroupPrefix));
                }
                topicList.setTopicList(newTopicSet);
            }
            return topicList;
        }
    }
    default:
        break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:33,代码来源:MQClientAPIImpl.java


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