@Override
    public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {

        try {
            defaultMQAdminExt =  createMQAdminExt(rpcHook);

            final String msgId = commandLine.getOptionValue('i').trim();
            final String topic = commandLine.getOptionValue('t').trim();
            final boolean showAll = commandLine.hasOption('a');
            if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
                final String consumerGroup = commandLine.getOptionValue('g').trim();
                final String clientId = commandLine.getOptionValue('d').trim();
                ConsumerRunningInfo consumerRunningInfo = null;
                try {
                    consumerRunningInfo = defaultMQAdminExt.getConsumerRunningInfo(consumerGroup, clientId, false, false);
                } catch (Exception e) {
                    System.out.printf("get consumer runtime info for %s client failed \n", clientId);
                }
                if (consumerRunningInfo != null && ConsumerRunningInfo.isPushType(consumerRunningInfo)) {
                    ConsumeMessageDirectlyResult result =
                            defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, topic, msgId);
                    System.out.printf("%s", result);
                } else {
                    System.out.printf("get consumer info failed or this %s client is not push consumer ,not support direct push \n", clientId);
                }

            } else {
                queryById(defaultMQAdminExt, topic, msgId, showAll);
            }
        } catch (Exception e) {
            throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
        } finally {
            defaultMQAdminExt.shutdown();
        }
    }
@Test
    public void testExecute() throws SubCommandException {

        System.setProperty("rocketmq.namesrv.addr", "127.0.0.1:9876");

        String[] args = new String[]{"-t myTopicTest", "-i 0A3A54F7BF7D18B4AAC28A3FA2CF0000"};
        Options options = ServerUtil.buildCommandlineOptions(new Options());
        CommandLine commandLine = ServerUtil.parseCmdLine("mqadmin ", args,
            cmd.buildCommandlineOptions(options), new DefaultParser());
        cmd.execute(commandLine, options, null);

        args = new String[] {"-t myTopicTest", "-i 0A3A54F7BF7D18B4AAC28A3FA2CF0000", "-g producerGroupName", "-d clientId"};
        commandLine = ServerUtil.parseCmdLine("mqadmin ", args, cmd.buildCommandlineOptions(options),
            new DefaultParser());
        cmd.execute(commandLine, options, null);

    }