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

Java DefaultMQAdminExt类代码示例

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

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



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

示例1: execute

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

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

    try {
        defaultMQAdminExt.start();

        String topic = commandLine.getOptionValue('t').trim();
        TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic);
        String json = topicRouteData.toJson(true);
        System.out.println(json);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:22,代码来源:TopicRouteSubCommand.java


示例2: execute

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
    try {
        // namespace
        String namespace = commandLine.getOptionValue('s').trim();
        // key name
        String key = commandLine.getOptionValue('k').trim();
        // key name
        String value = commandLine.getOptionValue('v').trim();

        defaultMQAdminExt.start();
        defaultMQAdminExt.createAndUpdateKvConfig(namespace, key, value);
        System.out.printf("create or update kv config to namespace success.\n");
        return;
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:25,代码来源:UpdateKvConfigCommand.java


示例3: execute

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

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

    try {
        final String topic = commandLine.getOptionValue('t').trim();
        final String key = commandLine.getOptionValue('k').trim();

        this.queryByKey(defaultMQAdminExt, topic, key);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:20,代码来源:QueryMsgByKeySubCommand.java


示例4: execute

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
    try {
        // namespace
        String namespace = commandLine.getOptionValue('s').trim();
        // key name
        String key = commandLine.getOptionValue('k').trim();

        defaultMQAdminExt.start();
        defaultMQAdminExt.deleteKvConfig(namespace, key);
        System.out.printf("delete kv config from namespace success.\n");
        return;
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:23,代码来源:DeleteKvConfigCommand.java


示例5: execute

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@Override
public void execute(final CommandLine commandLine, final Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
    String topic = commandLine.getOptionValue('t').trim();
    try {
        defaultMQAdminExt.start();
        Set<String> clusters = defaultMQAdminExt.getTopicClusterList(topic);
        for (String value : clusters){
            System.out.println(value);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:20,代码来源:TopicClusterSubCommand.java


示例6: findTopicBelongToWhichCluster

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
private String findTopicBelongToWhichCluster(final String topic, final ClusterInfo clusterInfo,
        final DefaultMQAdminExt defaultMQAdminExt) throws RemotingException, MQClientException,
        InterruptedException {
    TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic);

    BrokerData brokerData = topicRouteData.getBrokerDatas().get(0);

    String brokerName = brokerData.getBrokerName();

    Iterator<Entry<String, Set<String>>> it = clusterInfo.getClusterAddrTable().entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, Set<String>> next = it.next();
        if (next.getValue().contains(brokerName)) {
            return next.getKey();
        }
    }

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


示例7: execute

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt adminExt = new DefaultMQAdminExt(rpcHook);
    adminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
    try {
        String topic = commandLine.getOptionValue('t').trim();

        if (commandLine.hasOption('c')) {
            String clusterName = commandLine.getOptionValue('c').trim();

            adminExt.start();
            deleteTopic(adminExt, clusterName, topic);
            return;
        }

        ServerUtil.printCommandLineHelp("mqadmin " + this.commandName(), options);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        adminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:25,代码来源:DeleteTopicSubCommand.java


示例8: deleteTopic

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
public static void deleteTopic(final DefaultMQAdminExt adminExt,//
        final String clusterName,//
        final String topic//
) throws InterruptedException, MQBrokerException, RemotingException, MQClientException {
    Set<String> masterSet = CommandUtil.fetchMasterAddrByClusterName(adminExt, clusterName);
    adminExt.deleteTopicInBroker(masterSet, topic);
    System.out.printf("delete topic [%s] from cluster [%s] success.\n", topic, clusterName);

    Set<String> nameServerSet = null;
    if (adminExt.getNamesrvAddr() != null) {
        String[] ns = adminExt.getNamesrvAddr().trim().split(";");
        nameServerSet = new HashSet(Arrays.asList(ns));
    }

    adminExt.deleteTopicInNameServer(nameServerSet, topic);
    System.out.printf("delete topic [%s] from NameServer success.\n", topic);
}
 
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:18,代码来源:DeleteTopicSubCommand.java


示例9: getConsumerConnection

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@CmdTrace(cmdClazz = ConsumerConnectionSubCommand.class)
public ConsumerConnection getConsumerConnection(String consumerGroup) throws Throwable {
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
    try {
        defaultMQAdminExt.start();
        ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(consumerGroup);
        return cc;
    }
    catch (Throwable e) {
        logger.error(e.getMessage(), e);
        t = e;
    }
    finally {
        shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:19,代码来源:ConnectionService.java


示例10: getProducerConnection

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@CmdTrace(cmdClazz = ProducerConnectionSubCommand.class)
public ProducerConnection getProducerConnection(String group, String topicName) throws Throwable {
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
    try {
        defaultMQAdminExt.start();
        ProducerConnection pc = defaultMQAdminExt.examineProducerConnectionInfo(group, topicName);
        return pc;
    }
    catch (Throwable e) {
        logger.error(e.getMessage(), e);
        t = e;
    }
    finally {
        shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:19,代码来源:ConnectionService.java


示例11: brokerStats

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@CmdTrace(cmdClazz = BrokerStatusSubCommand.class)
public Table brokerStats(String brokerAddr) throws Throwable {
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
    try {
        defaultMQAdminExt.start();
        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr);
        TreeMap<String, String> tmp = new TreeMap<String, String>();
        tmp.putAll(kvTable.getTable());
        return Table.Map2VTable(tmp);
    }
    catch (Throwable e) {
        logger.error(e.getMessage(), e);
        t = e;
    }
    finally {
        shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:21,代码来源:BrokerService.java


示例12: deleteKvConfig

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@CmdTrace(cmdClazz = DeleteKvConfigCommand.class)
public boolean deleteKvConfig(String namespace, String key) throws Throwable {
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
    try {
        defaultMQAdminExt.start();
        defaultMQAdminExt.deleteKvConfig(namespace, key);
        return true;
    }
    catch (Throwable e) {
        logger.error(e.getMessage(), e);
        t = e;
    }
    finally {
        shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:19,代码来源:NamesrvService.java


示例13: updateKvConfig

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@CmdTrace(cmdClazz = UpdateKvConfigCommand.class)
public boolean updateKvConfig(String namespace, String key, String value) throws Throwable {
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();
    try {
        defaultMQAdminExt.start();
        defaultMQAdminExt.createAndUpdateKvConfig(namespace, key, value);
        return true;
    }
    catch (Throwable e) {
        logger.error(e.getMessage(), e);
        t = e;
    }
    finally {
        shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:19,代码来源:NamesrvService.java


示例14: updateProjectGroup

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@CmdTrace(cmdClazz = UpdateProjectGroupCommand.class)
public boolean updateProjectGroup(String ip, String project) throws Throwable {
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
    String namespace = NamesrvUtil.NAMESPACE_PROJECT_CONFIG;
    try {
        defaultMQAdminExt.start();
        defaultMQAdminExt.createAndUpdateKvConfig(namespace, ip, project);
        return true;
    }
    catch (Throwable e) {
        logger.error(e.getMessage(), e);
        t = e;
    }
    finally {
        shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:20,代码来源:NamesrvService.java


示例15: execute

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

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

    try {
        final String msgId = commandLine.getOptionValue('i').trim();
        queryById(defaultMQAdminExt, msgId);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:18,代码来源:QueryMsgByIdSubCommand.java


示例16: queryByKey

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
void queryByKey(final DefaultMQAdminExt admin, final String topic, final String key,
        final long fallbackHours) throws MQClientException, InterruptedException {
    admin.start();

    /**
     * 默认查询三天的前到现在的消息
     */
    long end = System.currentTimeMillis() - (fallbackHours * 60 * 60 * 1000);
    long begin = end - (72 * 60 * 60 * 1000);

    QueryResult queryResult = admin.queryMessage(topic, key, 32, begin, end);
    System.out.printf("%-50s %-4s  %s\n",//
        "#Message ID",//
        "#QID",//
        "#Offset");
    for (MessageExt msg : queryResult.getMessageList()) {
        System.out.printf("%-50s %-4d %d\n", msg.getMsgId(), msg.getQueueId(), msg.getQueueOffset());
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:20,代码来源:QueryMsgByKeySubCommand.java


示例17: execute

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

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

    try {
        final String topic = commandLine.getOptionValue('t').trim();
        final String key = commandLine.getOptionValue('k').trim();
        long h = 0;
        if (commandLine.hasOption('f')) {
            final String fallbackHours = commandLine.getOptionValue('f').trim();
            if (fallbackHours != null) {
                h = Long.parseLong(fallbackHours);
            }
        }

        this.queryByKey(defaultMQAdminExt, topic, key, h);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:27,代码来源:QueryMsgByKeySubCommand.java


示例18: execute

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
    try {
        // namespace
        String namespace = commandLine.getOptionValue('s').trim();
        // key name
        String key = commandLine.getOptionValue('k').trim();
        // key name
        String value = commandLine.getOptionValue('v').trim();

        defaultMQAdminExt.start();
        defaultMQAdminExt.createAndUpdateKvConfig(namespace, key, value);
        System.out.printf("create or update kv config to namespace success.\n");
        return;
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:25,代码来源:UpdateKvConfigCommand.java


示例19: execute

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
    try {
        // namespace
        String namespace = commandLine.getOptionValue('s').trim();
        // key name
        String key = commandLine.getOptionValue('k').trim();

        defaultMQAdminExt.start();
        defaultMQAdminExt.deleteKvConfig(namespace, key);
        System.out.printf("delete kv config from namespace success.\n");
        return;
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:23,代码来源:DeleteKvConfigCommand.java


示例20: execute

import com.alibaba.rocketmq.tools.admin.DefaultMQAdminExt; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
    try {
        String namespace = NamesrvUtil.NAMESPACE_PROJECT_CONFIG;
        String ip = commandLine.getOptionValue('i').trim();
        String project = commandLine.getOptionValue('p').trim();

        defaultMQAdminExt.start();
        defaultMQAdminExt.createAndUpdateKvConfig(namespace, ip, project);
        System.out.printf("create or update kv config to namespace success.\n");
        return;
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:22,代码来源:UpdateProjectGroupCommand.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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