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


Java ServerUtil类代码示例

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


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

示例1: execute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
    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) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        adminExt.shutdown();
    }
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:23,代码来源:DeleteTopicSubCommand.java

示例2: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Test
public void testExecute() {
    UpdateTopicSubCommand cmd = new UpdateTopicSubCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {
        "-b 127.0.0.1:10911",
        "-c default-cluster",
        "-t unit-test",
        "-r 8",
        "-w 8",
        "-p 6",
        "-o false",
        "-u false",
        "-s false"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    assertThat(commandLine.getOptionValue('b').trim()).isEqualTo("127.0.0.1:10911");
    assertThat(commandLine.getOptionValue('c').trim()).isEqualTo("default-cluster");
    assertThat(commandLine.getOptionValue('r').trim()).isEqualTo("8");
    assertThat(commandLine.getOptionValue('w').trim()).isEqualTo("8");
    assertThat(commandLine.getOptionValue('t').trim()).isEqualTo("unit-test");
    assertThat(commandLine.getOptionValue('p').trim()).isEqualTo("6");
    assertThat(commandLine.getOptionValue('o').trim()).isEqualTo("false");
    assertThat(commandLine.getOptionValue('u').trim()).isEqualTo("false");
    assertThat(commandLine.getOptionValue('s').trim()).isEqualTo("false");
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:27,代码来源:UpdateTopicSubCommandTest.java

示例3: execute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的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:lyy4j,项目名称:rmq4note,代码行数:23,代码来源:DeleteTopicSubCommand.java

示例4: main

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
public static void main(String[] args) {
    QueryConsumeQueueCommand cmd = new QueryConsumeQueueCommand();

    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[]{"-t TopicTest", "-q 0", "-i 6447", "-b 100.81.165.119:10911"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options),
            new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:QueryConsumeQueueCommand.java

示例5: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Ignore
@Test
public void testExecute() throws SubCommandException {
    ConsumerStatusSubCommand cmd = new ConsumerStatusSubCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-g default-group", "-i cid_one"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:ConsumerStatusSubCommandTest.java

示例6: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Ignore
@Test
public void testExecute() throws SubCommandException {
    ConsumerProgressSubCommand cmd = new ConsumerProgressSubCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-g default-group"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:ConsumerProgressSubCommandTest.java

示例7: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Test
public void testExecute() {
    ResetOffsetByTimeOldCommand cmd = new ResetOffsetByTimeOldCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-g default-group", "-t unit-test", "-s 1412131213231", "-f false"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    assertThat(commandLine.getOptionValue('g').trim()).isEqualTo("default-group");
    assertThat(commandLine.getOptionValue('t').trim()).isEqualTo("unit-test");
    assertThat(commandLine.getOptionValue('s').trim()).isEqualTo("1412131213231");
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:12,代码来源:ResetOffsetByTimeOldCommandTest.java

示例8: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Ignore
@Test
public void testExecute() throws SubCommandException {
    GetConsumerStatusCommand cmd = new GetConsumerStatusCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-g default-group", "-t unit-test", "-i clientid"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:GetConsumerStatusCommandTest.java

示例9: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Ignore
@Test
public void testExecute() throws SubCommandException {
    ResetOffsetByTimeCommand cmd = new ResetOffsetByTimeCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-g default-group", "-t unit-test", "-s 1412131213231", "-f false"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:ResetOffsetByTimeCommandTest.java

示例10: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Ignore
@Test
public void testExecute() throws SubCommandException {
    BrokerConsumeStatsSubCommad cmd = new BrokerConsumeStatsSubCommad();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-b 127.0.0.1:10911", "-t 3000", "-l 5", "-o true"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:BrokerConsumeStatsSubCommadTest.java

示例11: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Ignore
@Test
public void testExecute() throws SubCommandException {
    GetBrokerConfigCommand cmd = new GetBrokerConfigCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-b 127.0.0.1:10911", "-c default-cluster"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:GetBrokerConfigCommandTest.java

示例12: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Test
public void testExecute() {
    SendMsgStatusCommand cmd = new SendMsgStatusCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-b 127.0.0.1:10911", "-s 1024 -c 10"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    //cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:10,代码来源:SendMsgStatusCommandTest.java

示例13: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Ignore
@Test
public void testExecute() throws SubCommandException {
    UpdateBrokerConfigSubCommand cmd = new UpdateBrokerConfigSubCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-b 127.0.0.1:10911", "-c default-cluster", "-k topicname", "-v unit_test"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:UpdateBrokerConfigSubCommandTest.java

示例14: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Ignore
@Test
public void testExecute() throws SubCommandException {
    CleanExpiredCQSubCommand cmd = new CleanExpiredCQSubCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-b 127.0.0.1:10911", "-c default-cluster"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:CleanExpiredCQSubCommandTest.java

示例15: testExecute

import org.apache.rocketmq.srvutil.ServerUtil; //导入依赖的package包/类
@Ignore
@Test
public void testExecute() throws SubCommandException {
    BrokerStatusSubCommand cmd = new BrokerStatusSubCommand();
    Options options = ServerUtil.buildCommandlineOptions(new Options());
    String[] subargs = new String[] {"-b 127.0.0.1:10911", "-c default-cluster"};
    final CommandLine commandLine =
        ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());
    cmd.execute(commandLine, options, null);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:11,代码来源:BrokerStatusSubCommandTest.java


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