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

The following examples show how to use org.apache.rocketmq.tools.admin.DefaultMQAdminExt#examineConsumerConnectionInfo() . 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: ConsumerProgressSubCommand.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
private Map<MessageQueue, String> getMessageQueueAllocationResult(DefaultMQAdminExt defaultMQAdminExt,
    String groupName) {
    Map<MessageQueue, String> results = new HashMap<>();
    try {
        ConsumerConnection consumerConnection = defaultMQAdminExt.examineConsumerConnectionInfo(groupName);
        for (Connection connection : consumerConnection.getConnectionSet()) {
            String clientId = connection.getClientId();
            ConsumerRunningInfo consumerRunningInfo = defaultMQAdminExt.getConsumerRunningInfo(groupName, clientId,
                false);
            for (MessageQueue messageQueue : consumerRunningInfo.getMqTable().keySet()) {
                results.put(messageQueue, clientId.split("@")[0]);
            }
        }
    } catch (Exception ignore) {
    }
    return results;
}
 
Example 2
Source File: ConsumerProgressSubCommand.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
private Map<MessageQueue, String> getMessageQueueAllocationResult(DefaultMQAdminExt defaultMQAdminExt,
    String groupName) {
    Map<MessageQueue, String> results = new HashMap<>();
    try {
        ConsumerConnection consumerConnection = defaultMQAdminExt.examineConsumerConnectionInfo(groupName);
        for (Connection connection : consumerConnection.getConnectionSet()) {
            String clientId = connection.getClientId();
            ConsumerRunningInfo consumerRunningInfo = defaultMQAdminExt.getConsumerRunningInfo(groupName, clientId,
                false);
            for (MessageQueue messageQueue : consumerRunningInfo.getMqTable().keySet()) {
                results.put(messageQueue, clientId.split("@")[0]);
            }
        }
    } catch (Exception ignore) {
    }
    return results;
}
 
Example 3
Source File: ConsumerProgressSubCommand.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
private Map<MessageQueue, String> getMessageQueueAllocationResult(DefaultMQAdminExt defaultMQAdminExt,
    String groupName) {
    Map<MessageQueue, String> results = new HashMap<>();
    try {
        ConsumerConnection consumerConnection = defaultMQAdminExt.examineConsumerConnectionInfo(groupName);
        for (Connection connection : consumerConnection.getConnectionSet()) {
            String clientId = connection.getClientId();
            ConsumerRunningInfo consumerRunningInfo = defaultMQAdminExt.getConsumerRunningInfo(groupName, clientId,
                false);
            for (MessageQueue messageQueue : consumerRunningInfo.getMqTable().keySet()) {
                results.put(messageQueue, clientId.split("@")[0]);
            }
        }
    } catch (Exception ignore) {
    }
    return results;
}
 
Example 4
Source File: ConsumerProgressSubCommand.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
private Map<MessageQueue, String> getMessageQueueAllocationResult(DefaultMQAdminExt defaultMQAdminExt,
    String groupName) {
    Map<MessageQueue, String> results = new HashMap<>();
    try {
        ConsumerConnection consumerConnection = defaultMQAdminExt.examineConsumerConnectionInfo(groupName);
        for (Connection connection : consumerConnection.getConnectionSet()) {
            String clientId = connection.getClientId();
            ConsumerRunningInfo consumerRunningInfo = defaultMQAdminExt.getConsumerRunningInfo(groupName, clientId,
                false);
            for (MessageQueue messageQueue : consumerRunningInfo.getMqTable().keySet()) {
                results.put(messageQueue, clientId.split("@")[0]);
            }
        }
    } catch (Exception ignore) {
    }
    return results;
}
 
Example 5
Source File: ConsumerProgressSubCommand.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
private Map<MessageQueue, String> getMessageQueueAllocationResult(DefaultMQAdminExt defaultMQAdminExt,
    String groupName) {
    Map<MessageQueue, String> results = new HashMap<>();
    try {
        ConsumerConnection consumerConnection = defaultMQAdminExt.examineConsumerConnectionInfo(groupName);
        for (Connection connection : consumerConnection.getConnectionSet()) {
            String clientId = connection.getClientId();
            ConsumerRunningInfo consumerRunningInfo = defaultMQAdminExt.getConsumerRunningInfo(groupName, clientId,
                false);
            for (MessageQueue messageQueue : consumerRunningInfo.getMqTable().keySet()) {
                results.put(messageQueue, clientId.split("@")[0]);
            }
        }
    } catch (Exception ignore) {
    }
    return results;
}
 
Example 6
Source File: ConsumerProgressSubCommand.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
private Map<MessageQueue, String> getMessageQueueAllocationResult(DefaultMQAdminExt defaultMQAdminExt,
    String groupName) {
    Map<MessageQueue, String> results = new HashMap<>();
    try {
        ConsumerConnection consumerConnection = defaultMQAdminExt.examineConsumerConnectionInfo(groupName);
        for (Connection connection : consumerConnection.getConnectionSet()) {
            String clientId = connection.getClientId();
            ConsumerRunningInfo consumerRunningInfo = defaultMQAdminExt.getConsumerRunningInfo(groupName, clientId,
                false);
            for (MessageQueue messageQueue : consumerRunningInfo.getMqTable().keySet()) {
                results.put(messageQueue, clientId.split("@")[0]);
            }
        }
    } catch (Exception ignore) {
    }
    return results;
}
 
Example 7
Source File: ConsumerConnectionSubCommand.java    From DDMQ with Apache License 2.0 4 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();

        String group = commandLine.getOptionValue('g').trim();

        ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group);

        int i = 1;
        for (Connection conn : cc.getConnectionSet()) {
            System.out.printf("%03d  %-32s %-22s %-8s %s%n",
                i++,
                conn.getClientId(),
                conn.getClientAddr(),
                conn.getLanguage(),
                MQVersion.getVersionDesc(conn.getVersion())
            );
        }

        System.out.printf("%nBelow is subscription:");
        Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator();
        i = 1;
        while (it.hasNext()) {
            Entry<String, SubscriptionData> entry = it.next();
            SubscriptionData sd = entry.getValue();
            System.out.printf("%03d  Topic: %-40s SubExpression: %s%n",
                i++,
                sd.getTopic(),
                sd.getSubString()
            );
        }

        System.out.printf("");
        System.out.printf("ConsumeType: %s%n", cc.getConsumeType());
        System.out.printf("MessageModel: %s%n", cc.getMessageModel());
        System.out.printf("ConsumeFromWhere: %s%n", cc.getConsumeFromWhere());
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 8
Source File: ConsumerConnectionSubCommand.java    From rocketmq-4.3.0 with Apache License 2.0 4 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();

        String group = commandLine.getOptionValue('g').trim();

        ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group);

        int i = 1;
        for (Connection conn : cc.getConnectionSet()) {
            System.out.printf("%03d  %-32s %-22s %-8s %s%n",
                i++,
                conn.getClientId(),
                conn.getClientAddr(),
                conn.getLanguage(),
                MQVersion.getVersionDesc(conn.getVersion())
            );
        }

        System.out.printf("%nBelow is subscription:");
        Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator();
        i = 1;
        while (it.hasNext()) {
            Entry<String, SubscriptionData> entry = it.next();
            SubscriptionData sd = entry.getValue();
            System.out.printf("%03d  Topic: %-40s SubExpression: %s%n",
                i++,
                sd.getTopic(),
                sd.getSubString()
            );
        }

        System.out.printf("");
        System.out.printf("ConsumeType: %s%n", cc.getConsumeType());
        System.out.printf("MessageModel: %s%n", cc.getMessageModel());
        System.out.printf("ConsumeFromWhere: %s%n", cc.getConsumeFromWhere());
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 9
Source File: ConsumerConnectionSubCommand.java    From rocketmq-read with Apache License 2.0 4 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();

        String group = commandLine.getOptionValue('g').trim();

        ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group);

        int i = 1;
        for (Connection conn : cc.getConnectionSet()) {
            System.out.printf("%03d  %-32s %-22s %-8s %s%n",
                i++,
                conn.getClientId(),
                conn.getClientAddr(),
                conn.getLanguage(),
                MQVersion.getVersionDesc(conn.getVersion())
            );
        }

        System.out.printf("%nBelow is subscription:");
        Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator();
        i = 1;
        while (it.hasNext()) {
            Entry<String, SubscriptionData> entry = it.next();
            SubscriptionData sd = entry.getValue();
            System.out.printf("%03d  Topic: %-40s SubExpression: %s%n",
                i++,
                sd.getTopic(),
                sd.getSubString()
            );
        }

        System.out.printf("");
        System.out.printf("ConsumeType: %s%n", cc.getConsumeType());
        System.out.printf("MessageModel: %s%n", cc.getMessageModel());
        System.out.printf("ConsumeFromWhere: %s%n", cc.getConsumeFromWhere());
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 10
Source File: ConsumerConnectionSubCommand.java    From rocketmq with Apache License 2.0 4 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();

        String group = commandLine.getOptionValue('g').trim();

        ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group);

        int i = 1;
        for (Connection conn : cc.getConnectionSet()) {
            System.out.printf("%03d  %-32s %-22s %-8s %s%n",
                i++,
                conn.getClientId(),
                conn.getClientAddr(),
                conn.getLanguage(),
                MQVersion.getVersionDesc(conn.getVersion())
            );
        }

        System.out.printf("%nBelow is subscription:");
        Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator();
        i = 1;
        while (it.hasNext()) {
            Entry<String, SubscriptionData> entry = it.next();
            SubscriptionData sd = entry.getValue();
            System.out.printf("%03d  Topic: %-40s SubExpression: %s%n",
                i++,
                sd.getTopic(),
                sd.getSubString()
            );
        }

        System.out.printf("");
        System.out.printf("ConsumeType: %s%n", cc.getConsumeType());
        System.out.printf("MessageModel: %s%n", cc.getMessageModel());
        System.out.printf("ConsumeFromWhere: %s%n", cc.getConsumeFromWhere());
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 11
Source File: ConsumerConnectionSubCommand.java    From DDMQ with Apache License 2.0 4 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();

        String group = commandLine.getOptionValue('g').trim();

        ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group);

        int i = 1;
        for (Connection conn : cc.getConnectionSet()) {
            System.out.printf("%03d  %-32s %-22s %-8s %s%n",
                i++,
                conn.getClientId(),
                conn.getClientAddr(),
                conn.getLanguage(),
                MQVersion.getVersionDesc(conn.getVersion())
            );
        }

        System.out.printf("%nBelow is subscription:");
        Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator();
        i = 1;
        while (it.hasNext()) {
            Entry<String, SubscriptionData> entry = it.next();
            SubscriptionData sd = entry.getValue();
            System.out.printf("%03d  Topic: %-40s SubExpression: %s%n",
                i++,
                sd.getTopic(),
                sd.getSubString()
            );
        }

        System.out.printf("");
        System.out.printf("ConsumeType: %s%n", cc.getConsumeType());
        System.out.printf("MessageModel: %s%n", cc.getMessageModel());
        System.out.printf("ConsumeFromWhere: %s%n", cc.getConsumeFromWhere());
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 12
Source File: ConsumerConnectionSubCommand.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 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();

        String group = commandLine.getOptionValue('g').trim();

        ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group);

        int i = 1;
        for (Connection conn : cc.getConnectionSet()) {
            System.out.printf("%03d  %-32s %-22s %-8s %s%n",
                i++,
                conn.getClientId(),
                conn.getClientAddr(),
                conn.getLanguage(),
                MQVersion.getVersionDesc(conn.getVersion())
            );
        }

        System.out.printf("%nBelow is subscription:");
        Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator();
        i = 1;
        while (it.hasNext()) {
            Entry<String, SubscriptionData> entry = it.next();
            SubscriptionData sd = entry.getValue();
            System.out.printf("%03d  Topic: %-40s SubExpression: %s%n",
                i++,
                sd.getTopic(),
                sd.getSubString()
            );
        }

        System.out.printf("");
        System.out.printf("ConsumeType: %s%n", cc.getConsumeType());
        System.out.printf("MessageModel: %s%n", cc.getMessageModel());
        System.out.printf("ConsumeFromWhere: %s%n", cc.getConsumeFromWhere());
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 13
Source File: ConsumerConnectionSubCommand.java    From rocketmq_trans_message with Apache License 2.0 4 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();

        String group = commandLine.getOptionValue('g').trim();

        ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group);

        int i = 1;
        for (Connection conn : cc.getConnectionSet()) {
            System.out.printf("%03d  %-32s %-22s %-8s %s%n",
                i++,
                conn.getClientId(),
                conn.getClientAddr(),
                conn.getLanguage(),
                MQVersion.getVersionDesc(conn.getVersion())
            );
        }

        System.out.printf("%nBelow is subscription:");
        Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator();
        i = 1;
        while (it.hasNext()) {
            Entry<String, SubscriptionData> entry = it.next();
            SubscriptionData sd = entry.getValue();
            System.out.printf("%03d  Topic: %-40s SubExpression: %s%n",
                i++,
                sd.getTopic(),
                sd.getSubString()
            );
        }

        System.out.printf("");
        System.out.printf("ConsumeType: %s%n", cc.getConsumeType());
        System.out.printf("MessageModel: %s%n", cc.getMessageModel());
        System.out.printf("ConsumeFromWhere: %s%n", cc.getConsumeFromWhere());
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 14
Source File: ConsumerConnectionSubCommand.java    From rocketmq with Apache License 2.0 4 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();

        String group = commandLine.getOptionValue('g').trim();

        ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group);

        int i = 1;
        for (Connection conn : cc.getConnectionSet()) {
            System.out.printf("%03d  %-32s %-22s %-8s %s%n",
                i++,
                conn.getClientId(),
                conn.getClientAddr(),
                conn.getLanguage(),
                MQVersion.getVersionDesc(conn.getVersion())
            );
        }

        System.out.printf("%nBelow is subscription:");
        Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator();
        i = 1;
        while (it.hasNext()) {
            Entry<String, SubscriptionData> entry = it.next();
            SubscriptionData sd = entry.getValue();
            System.out.printf("%03d  Topic: %-40s SubExpression: %s%n",
                i++,
                sd.getTopic(),
                sd.getSubString()
            );
        }

        System.out.printf("");
        System.out.printf("ConsumeType: %s%n", cc.getConsumeType());
        System.out.printf("MessageModel: %s%n", cc.getMessageModel());
        System.out.printf("ConsumeFromWhere: %s%n", cc.getConsumeFromWhere());
    } catch (Exception e) {
        throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
    } finally {
        defaultMQAdminExt.shutdown();
    }
}