@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();
            String brokerAddr = commandLine.getOptionValue('b').trim();
            ProducerTableInfo cc = defaultMQAdminExt.getAllProducerInfo(brokerAddr);
            if (cc != null && cc.getData() != null && !cc.getData().isEmpty()) {
                for (String group : cc.getData().keySet()) {
                    List<ProducerInfo> list = cc.getData().get(group);
                    if (list == null || list.isEmpty()) {
                        System.out.printf("producer group (%s) instances are empty\n", group);
                        continue;
                    }
                    for (ProducerInfo producer : list) {
                        System.out.printf("producer group (%s) instance : %s\n", group, producer.toString());
                    }
                }
            }
        } catch (Exception e) {
            throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
        } finally {
            defaultMQAdminExt.shutdown();
        }
    }
@Test
    public void testExecute() throws SubCommandException {
        ProducerSubCommand cmd = new ProducerSubCommand();
        Options options = ServerUtil.buildCommandlineOptions(new Options());
        String[] subargs = new String[]{"-b 127.0.0.1:" + brokerMocker.listenPort()};
        final CommandLine commandLine =
                ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs,
                    cmd.buildCommandlineOptions(options), new DefaultParser());
        cmd.execute(commandLine, options, null);
    }