• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TopicList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: getTopicsByCluster

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
/**
 * Name Server: 获取指定集群下的所有 topic
 */
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);

            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,代码行数:35,代码来源:MQClientAPIImpl.java


示例17: getTopicsByCluster

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
/**
 * 获取指定集群下的所有 topic 列表
 * 
 * @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:diwayou,项目名称:rocketmq-all-trans,代码行数:39,代码来源:RouteInfoManager.java


示例18: 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(MQRequestCode.GET_ALL_TOPIC_LIST_FROM_NAMESERVER_VALUE,
                null);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        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:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:34,代码来源:MQClientAPIImpl.java


示例19: fetchAllTopicList

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
@Override
public TopicList fetchAllTopicList() throws RemotingException, MQClientException, InterruptedException {
    TopicList topicList = MQAdminInstance.threadLocalMQAdminExt().fetchAllTopicList();
    logger.info("op=look={}", JsonUtil.obj2String(topicList.getTopicList()));
    return topicList;
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:7,代码来源:MQAdminExtImpl.java


示例20: fetchTopicsByCLuster

import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入依赖的package包/类
@Override //可以根据集群细分topic了
public TopicList fetchTopicsByCLuster(String clusterName) throws RemotingException, MQClientException, InterruptedException {
    return  MQAdminInstance.threadLocalMQAdminExt().fetchTopicsByCLuster(clusterName);
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:5,代码来源:MQAdminExtImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HasOneWidget类代码示例发布时间:2022-05-22
下一篇:
Java ScenarioOutline类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap