Java Code Examples for org.apache.rocketmq.tools.admin.DefaultMQAdminExt#consumeMessageDirectly()

The following examples show how to use org.apache.rocketmq.tools.admin.DefaultMQAdminExt#consumeMessageDirectly() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryMsgByUniqueKeySubCommand.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        final String topic = commandLine.getOptionValue('t').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, topic, msgId);
            System.out.printf("%s", result);
        } else {
            queryById(defaultMQAdminExt, topic, msgId);
        }
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 2
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        final String topic = commandLine.getOptionValue('t').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, topic, msgId);
            System.out.printf("%s", result);
        } else {
            queryById(defaultMQAdminExt, topic, msgId);
        }
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 3
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        final String topic = commandLine.getOptionValue('t').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, topic, msgId);
            System.out.printf("%s", result);
        } else {
            queryById(defaultMQAdminExt, topic, msgId);
        }
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 4
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        final String topic = commandLine.getOptionValue('t').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, topic, msgId);
            System.out.printf("%s", result);
        } else {
            queryById(defaultMQAdminExt, topic, msgId);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 5
Source File: QueryMsgByUniqueKeySubCommand.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        final String topic = commandLine.getOptionValue('t').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, topic, msgId);
            System.out.printf("%s", result);
        } else {
            queryById(defaultMQAdminExt, topic, msgId);
        }
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 6
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        final String topic = commandLine.getOptionValue('t').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, topic, msgId);
            System.out.printf("%s", result);
        } else {
            queryById(defaultMQAdminExt, topic, msgId);
        }
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 7
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        final String topic = commandLine.getOptionValue('t').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, topic, msgId);
            System.out.printf("%s", result);
        } else {
            queryById(defaultMQAdminExt, topic, msgId);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 8
Source File: QueryMsgByIdSubCommand.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
private void pushMsg(final DefaultMQAdminExt defaultMQAdminExt, final String consumerGroup, final String clientId,
    final String msgId) {
    try {
        ConsumeMessageDirectlyResult result =
            defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
        System.out.printf("%s", result);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 9
Source File: QueryMsgByIdSubCommand.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
private void pushMsg(final DefaultMQAdminExt defaultMQAdminExt, final String consumerGroup, final String clientId,
    final String msgId) {
    try {
        ConsumeMessageDirectlyResult result =
            defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
        System.out.printf("%s", result);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 10
Source File: QueryMsgByIdSubCommand.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
private void pushMsg(final DefaultMQAdminExt defaultMQAdminExt, final String consumerGroup, final String clientId,
    final String msgId) {
    try {
        ConsumeMessageDirectlyResult result =
            defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
        System.out.printf("%s", result);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 11
Source File: QueryMsgByIdSubCommand.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
private void pushMsg(final DefaultMQAdminExt defaultMQAdminExt, final String consumerGroup, final String clientId, final String msgId) {
    try {
        ConsumeMessageDirectlyResult result =
            defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
        System.out.printf("%s", result);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 12
Source File: QueryMsgByIdSubCommand.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
private void pushMsg(final DefaultMQAdminExt defaultMQAdminExt, final String consumerGroup, final String clientId,
    final String msgId) {
    try {
        ConsumeMessageDirectlyResult result =
            defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
        System.out.printf("%s", result);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 13
Source File: QueryMsgByIdSubCommand.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
private void pushMsg(final DefaultMQAdminExt defaultMQAdminExt, final String consumerGroup, final String clientId, final String msgId) {
    try {
        ConsumeMessageDirectlyResult result =
            defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
        System.out.printf("%s", result);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 14
Source File: QueryMsgByIdSubCommand.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
private void pushMsg(final DefaultMQAdminExt defaultMQAdminExt, final String consumerGroup, final String clientId, final String msgId) {
    try {
        ConsumeMessageDirectlyResult result =
            defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
        System.out.printf("%s", result);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 15
Source File: QueryMsgByIdSubCommand.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
private void pushMsg(final DefaultMQAdminExt defaultMQAdminExt, final String consumerGroup, final String clientId,
    final String msgId) {
    try {
        ConsumeMessageDirectlyResult result =
            defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
        System.out.printf("%s", result);
    } catch (Exception e) {
        e.printStackTrace();
    }
}