Search in sources :

Example 1 with ConsumerRunningInfo

use of org.apache.rocketmq.common.protocol.body.ConsumerRunningInfo in project rocketmq-externals by apache.

the class ConsumerServiceImpl method getClientConnection.

private Map<MessageQueue, String> getClientConnection(String groupName) {
    Map<MessageQueue, String> results = Maps.newHashMap();
    try {
        ConsumerConnection consumerConnection = mqAdminExt.examineConsumerConnectionInfo(groupName);
        for (Connection connection : consumerConnection.getConnectionSet()) {
            String clinetId = connection.getClientId();
            ConsumerRunningInfo consumerRunningInfo = mqAdminExt.getConsumerRunningInfo(groupName, clinetId, false);
            for (MessageQueue messageQueue : consumerRunningInfo.getMqTable().keySet()) {
                // results.put(messageQueue, clinetId + " " + connection.getClientAddr());
                results.put(messageQueue, clinetId);
            }
        }
    } catch (Exception err) {
        logger.error("op=getClientConnection_error", err);
    }
    return results;
}
Also used : MessageQueue(org.apache.rocketmq.common.message.MessageQueue) Connection(org.apache.rocketmq.common.protocol.body.Connection) ConsumerConnection(org.apache.rocketmq.common.protocol.body.ConsumerConnection) ConsumerConnection(org.apache.rocketmq.common.protocol.body.ConsumerConnection) ConsumerRunningInfo(org.apache.rocketmq.common.protocol.body.ConsumerRunningInfo) MQClientException(org.apache.rocketmq.client.exception.MQClientException)

Aggregations

MQClientException (org.apache.rocketmq.client.exception.MQClientException)1 MessageQueue (org.apache.rocketmq.common.message.MessageQueue)1 Connection (org.apache.rocketmq.common.protocol.body.Connection)1 ConsumerConnection (org.apache.rocketmq.common.protocol.body.ConsumerConnection)1 ConsumerRunningInfo (org.apache.rocketmq.common.protocol.body.ConsumerRunningInfo)1