• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TopicStatsTable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.alibaba.rocketmq.common.admin.TopicStatsTable的典型用法代码示例。如果您正苦于以下问题:Java TopicStatsTable类的具体用法?Java TopicStatsTable怎么用?Java TopicStatsTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TopicStatsTable类属于com.alibaba.rocketmq.common.admin包,在下文中一共展示了TopicStatsTable类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTopicStatsInfo

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
public TopicStatsTable getTopicStatsInfo(final String addr, final String topic, final long timeoutMillis) throws InterruptedException,
        RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
    GetTopicStatsInfoRequestHeader requestHeader = new GetTopicStatsInfoRequestHeader();
    requestHeader.setTopic(topic);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_TOPIC_STATS_INFO, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        TopicStatsTable topicStatsTable = TopicStatsTable.decode(response.getBody(), TopicStatsTable.class);
        return topicStatsTable;
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:20,代码来源:MQClientAPIImpl.java


示例2: getTopicStatsInfo

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
public TopicStatsTable getTopicStatsInfo(final String addr, final String topic, final long timeoutMillis) throws InterruptedException,
        RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
    GetTopicStatsInfoRequestHeader requestHeader = new GetTopicStatsInfoRequestHeader();
    requestHeader.setTopic(topic);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_TOPIC_STATS_INFO, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            TopicStatsTable topicStatsTable = TopicStatsTable.decode(response.getBody(), TopicStatsTable.class);
            return topicStatsTable;
        }
        default:
            break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:20,代码来源:MQClientAPIImpl.java


示例3: examineTopicStats

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
@Override
public TopicStatsTable examineTopicStats(String topic) throws RemotingException, MQClientException,
        InterruptedException, MQBrokerException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    TopicStatsTable topicStatsTable = new TopicStatsTable();

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            TopicStatsTable tst =
                    this.mQClientFactory.getMQClientAPIImpl().getTopicStatsInfo(addr, topic, 3000);
            topicStatsTable.getOffsetTable().putAll(tst.getOffsetTable());
        }
    }

    if (topicStatsTable.getOffsetTable().isEmpty()) {
        throw new MQClientException("Not found the topic stats info", null);
    }

    return topicStatsTable;
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:22,代码来源:DefaultMQAdminExtImpl.java


示例4: stats

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
@Override
public TopicStatsTable stats(String topic) {
    try {
        return mqAdminExt.examineTopicStats(topic);
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:9,代码来源:TopicServiceImpl.java


示例5: getTopicStats

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
public List<String> getTopicStats(String topicName) throws Throwable
{
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = this.getDefaultMQAdminExt();
    List<String> topicList = new ArrayList<String>();
    try
    {
        defaultMQAdminExt.start();
        TopicStatsTable topicStatsTable = defaultMQAdminExt.examineTopicStats(topicName);
        List<MessageQueue> mqList = new LinkedList<MessageQueue>();
        mqList.addAll(topicStatsTable.getOffsetTable().keySet());
        Collections.sort(mqList);

        for (MessageQueue mq : mqList)
        {
            TopicOffset topicOffset = topicStatsTable.getOffsetTable().get(mq);
            topicList.add(this.buildMapToJson(topicName, "MinOffset", topicOffset.getMinOffset()));
            topicList.add(this.buildMapToJson(topicName, "MaxOffset", topicOffset.getMaxOffset()));
        }
        return topicList;
    }
    catch (Throwable e)
    {
        t = e;
    }
    finally
    {
        this.shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:32,代码来源:TopicService.java


示例6: getTopicStatsInfo

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
public TopicStatsTable getTopicStatsInfo(final String addr, final String topic, final long timeoutMillis)
        throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException,
        RemotingConnectException, MQBrokerException {
    // 添加虚拟运行环境相关的projectGroupPrefix
    String topicWithProjectGroup = topic;
    if (!UtilAll.isBlank(projectGroupPrefix)) {
        topicWithProjectGroup = VirtualEnvUtil.buildWithProjectGroup(topic, projectGroupPrefix);
    }

    GetTopicStatsInfoRequestHeader requestHeader = new GetTopicStatsInfoRequestHeader();
    requestHeader.setTopic(topicWithProjectGroup);

    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.GET_TOPIC_STATS_INFO, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        TopicStatsTable topicStatsTable =
                TopicStatsTable.decode(response.getBody(), TopicStatsTable.class);
        // 清除虚拟运行环境相关的projectGroupPrefix
        if (!UtilAll.isBlank(projectGroupPrefix)) {
            HashMap<MessageQueue, TopicOffset> newTopicOffsetMap =
                    new HashMap<MessageQueue, TopicOffset>();
            for (Map.Entry<MessageQueue, TopicOffset> messageQueue : topicStatsTable.getOffsetTable()
                .entrySet()) {
                MessageQueue key = messageQueue.getKey();
                key.setTopic(VirtualEnvUtil.clearProjectGroup(key.getTopic(), projectGroupPrefix));
                newTopicOffsetMap.put(key, messageQueue.getValue());
            }
            topicStatsTable.setOffsetTable(newTopicOffsetMap);
        }
        return topicStatsTable;
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:41,代码来源:MQClientAPIImpl.java


示例7: getTopicStatsInfo

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
public TopicStatsTable getTopicStatsInfo(final String addr, final String topic, final long timeoutMillis)
        throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException,
        RemotingConnectException, MQBrokerException {
    // 添加虚拟运行环境相关的projectGroupPrefix
    String topicWithProjectGroup = topic;
    if (!UtilAll.isBlank(projectGroupPrefix)) {
        topicWithProjectGroup = VirtualEnvUtil.buildWithProjectGroup(topic, projectGroupPrefix);
    }

    GetTopicStatsInfoRequestHeader requestHeader = new GetTopicStatsInfoRequestHeader();
    requestHeader.setTopic(topicWithProjectGroup);

    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.GET_TOPIC_STATS_INFO_VALUE, requestHeader);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        TopicStatsTable topicStatsTable =
                TopicStatsTable.decode(response.getBody(), TopicStatsTable.class);
        // 清除虚拟运行环境相关的projectGroupPrefix
        if (!UtilAll.isBlank(projectGroupPrefix)) {
            HashMap<MessageQueue, TopicOffset> newTopicOffsetMap =
                    new HashMap<MessageQueue, TopicOffset>();
            for (Map.Entry<MessageQueue, TopicOffset> messageQueue : topicStatsTable.getOffsetTable()
                .entrySet()) {
                MessageQueue key = messageQueue.getKey();
                key.setTopic(VirtualEnvUtil.clearProjectGroup(key.getTopic(), projectGroupPrefix));
                newTopicOffsetMap.put(key, messageQueue.getValue());
            }
            topicStatsTable.setOffsetTable(newTopicOffsetMap);
        }
        return topicStatsTable;
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:40,代码来源:MQClientAPIImpl.java


示例8: examineTopicStats

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
@Override
public TopicStatsTable examineTopicStats(String topic) throws RemotingException, MQClientException, InterruptedException,
        MQBrokerException {
    return defaultMQAdminExtImpl.examineTopicStats(topic);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:6,代码来源:DefaultMQAdminExt.java


示例9: examineTopicStats

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
TopicStatsTable examineTopicStats(final String topic) throws RemotingException, MQClientException, InterruptedException,
MQBrokerException;
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:3,代码来源:MQAdminExt.java


示例10: execute

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
@Override
public void execute(final CommandLine commandLine, final Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        String topic = commandLine.getOptionValue('t').trim();
        TopicStatsTable topicStatsTable = defaultMQAdminExt.examineTopicStats(topic);

        List<MessageQueue> mqList = new LinkedList<MessageQueue>();
        mqList.addAll(topicStatsTable.getOffsetTable().keySet());
        Collections.sort(mqList);

        System.out.printf("%-32s  %-4s  %-20s  %-20s    %s\n",//
            "#Broker Name",//
            "#QID",//
            "#Min Offset",//
            "#Max Offset",//
            "#Last Updated" //
        );

        for (MessageQueue mq : mqList) {
            TopicOffset topicOffset = topicStatsTable.getOffsetTable().get(mq);

            String humanTimestamp = "";
            if (topicOffset.getLastUpdateTimestamp() > 0) {
                humanTimestamp = UtilAll.timeMillisToHumanString2(topicOffset.getLastUpdateTimestamp());
            }

            System.out.printf("%-32s  %-4d  %-20d  %-20d    %s\n",//
                UtilAll.frontStringAtLeast(mq.getBrokerName(), 32),//
                mq.getQueueId(),//
                topicOffset.getMinOffset(),//
                topicOffset.getMaxOffset(),//
                humanTimestamp //
                );
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:49,代码来源:TopicStatusSubCommand.java


示例11: getTopicStatsInfo

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
private RemotingCommand getTopicStatsInfo(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetTopicStatsInfoRequestHeader requestHeader =
            (GetTopicStatsInfoRequestHeader) request.decodeCommandCustomHeader(GetTopicStatsInfoRequestHeader.class);

    final String topic = requestHeader.getTopic();
    TopicConfig topicConfig = this.brokerController.getTopicConfigManager().selectTopicConfig(topic);
    if (null == topicConfig) {
        response.setCode(ResponseCode.TOPIC_NOT_EXIST);
        response.setRemark("topic[" + topic + "] not exist");
        return response;
    }

    TopicStatsTable topicStatsTable = new TopicStatsTable();
    for (int i = 0; i < topicConfig.getWriteQueueNums(); i++) {
        MessageQueue mq = new MessageQueue();
        mq.setTopic(topic);
        mq.setBrokerName(this.brokerController.getBrokerConfig().getBrokerName());
        mq.setQueueId(i);

        TopicOffset topicOffset = new TopicOffset();
        long min = this.brokerController.getMessageStore().getMinOffsetInQuque(topic, i);
        if (min < 0)
            min = 0;

        long max = this.brokerController.getMessageStore().getMaxOffsetInQuque(topic, i);
        if (max < 0)
            max = 0;

        long timestamp = 0;
        if (max > 0) {
            timestamp = this.brokerController.getMessageStore().getMessageStoreTimeStamp(topic, i, (max - 1));
        }

        topicOffset.setMinOffset(min);
        topicOffset.setMaxOffset(max);
        topicOffset.setLastUpdateTimestamp(timestamp);

        topicStatsTable.getOffsetTable().put(mq, topicOffset);
    }

    byte[] body = topicStatsTable.encode();
    response.setBody(body);
    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:48,代码来源:AdminBrokerProcessor.java


示例12: examineTopicStats

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
@Override
public TopicStatsTable examineTopicStats(String topic)
        throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    return MQAdminInstance.threadLocalMQAdminExt().examineTopicStats(topic);
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:6,代码来源:MQAdminExtImpl.java


示例13: examineTopicStats

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
@Override
public TopicStatsTable examineTopicStats(String topic) throws RemotingException, MQClientException,
        InterruptedException, MQBrokerException {
    return defaultMQAdminExtImpl.examineTopicStats(topic);
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:6,代码来源:DefaultMQAdminExt.java


示例14: execute

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
@Override
public void execute(final CommandLine commandLine, final Options options) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        String topic = commandLine.getOptionValue('t').trim();
        TopicStatsTable topicStatsTable = defaultMQAdminExt.examineTopicStats(topic);

        List<MessageQueue> mqList = new LinkedList<MessageQueue>();
        mqList.addAll(topicStatsTable.getOffsetTable().keySet());
        Collections.sort(mqList);

        System.out.printf("%-32s  %-4s  %-20s  %-20s    %s\n",//
            "#Broker Name",//
            "#QID",//
            "#Min Offset",//
            "#Max Offset",//
            "#Last Updated" //
        );

        for (MessageQueue mq : mqList) {
            TopicOffset topicOffset = topicStatsTable.getOffsetTable().get(mq);

            String humanTimestamp = "";
            if (topicOffset.getLastUpdateTimestamp() > 0) {
                humanTimestamp = UtilAll.timeMillisToHumanString2(topicOffset.getLastUpdateTimestamp());
            }

            System.out.printf("%-32s  %-4d  %-20d  %-20d    %s\n",//
                UtilAll.frontStringAtLeast(mq.getBrokerName(), 32),//
                mq.getQueueId(),//
                topicOffset.getMinOffset(),//
                topicOffset.getMaxOffset(),//
                humanTimestamp //
                );
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:49,代码来源:TopicStatsSubCommand.java


示例15: getTopicStatsInfo

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
private RemotingCommand getTopicStatsInfo(ChannelHandlerContext ctx, RemotingCommand request)
        throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetTopicStatsInfoRequestHeader requestHeader =
            (GetTopicStatsInfoRequestHeader) request
                .decodeCommandCustomHeader(GetTopicStatsInfoRequestHeader.class);

    final String topic = requestHeader.getTopic();
    TopicConfig topicConfig = this.brokerController.getTopicConfigManager().selectTopicConfig(topic);
    if (null == topicConfig) {
        response.setCode(ResponseCode.TOPIC_NOT_EXIST);
        response.setRemark("topic[" + topic + "] not exist");
        return response;
    }

    TopicStatsTable topicStatsTable = new TopicStatsTable();
    for (int i = 0; i < topicConfig.getWriteQueueNums(); i++) {
        MessageQueue mq = new MessageQueue();
        mq.setTopic(topic);
        mq.setBrokerName(this.brokerController.getBrokerConfig().getBrokerName());
        mq.setQueueId(i);

        TopicOffset topicOffset = new TopicOffset();
        long min = this.brokerController.getMessageStore().getMinOffsetInQuque(topic, i);
        if (min < 0)
            min = 0;

        long max = this.brokerController.getMessageStore().getMaxOffsetInQuque(topic, i);
        if (max < 0)
            max = 0;

        long timestamp = 0;
        if (max > 0) {
            timestamp =
                    this.brokerController.getMessageStore().getMessageStoreTimeStamp(topic, i, (max - 1));
        }

        topicOffset.setMinOffset(min);
        topicOffset.setMaxOffset(max);
        topicOffset.setLastUpdateTimestamp(timestamp);

        topicStatsTable.getOffsetTable().put(mq, topicOffset);
    }

    byte[] body = topicStatsTable.encode();
    response.setBody(body);
    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:51,代码来源:AdminBrokerProcessor.java


示例16: getTopicStatsInfo

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
private RemotingCommand getTopicStatsInfo(ChannelHandlerContext ctx, RemotingCommand request)
        throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetTopicStatsInfoRequestHeader requestHeader =
            (GetTopicStatsInfoRequestHeader) request
                .decodeCommandCustomHeader(GetTopicStatsInfoRequestHeader.class);

    final String topic = requestHeader.getTopic();
    TopicConfig topicConfig = this.brokerController.getTopicConfigManager().selectTopicConfig(topic);
    if (null == topicConfig) {
        response.setCode(MQResponseCode.TOPIC_NOT_EXIST_VALUE);
        response.setRemark("topic[" + topic + "] not exist");
        return response;
    }

    TopicStatsTable topicStatsTable = new TopicStatsTable();
    for (int i = 0; i < topicConfig.getWriteQueueNums(); i++) {
        MessageQueue mq = new MessageQueue();
        mq.setTopic(topic);
        mq.setBrokerName(this.brokerController.getBrokerConfig().getBrokerName());
        mq.setQueueId(i);

        TopicOffset topicOffset = new TopicOffset();
        long min = this.brokerController.getMessageStore().getMinOffsetInQuque(topic, i);
        if (min < 0)
            min = 0;

        long max = this.brokerController.getMessageStore().getMaxOffsetInQuque(topic, i);
        if (max < 0)
            max = 0;

        long timestamp = 0;
        if (max > 0) {
            timestamp =
                    this.brokerController.getMessageStore().getMessageStoreTimeStamp(topic, i, (max - 1));
        }

        topicOffset.setMinOffset(min);
        topicOffset.setMaxOffset(max);
        topicOffset.setLastUpdateTimestamp(timestamp);

        topicStatsTable.getOffsetTable().put(mq, topicOffset);
    }

    byte[] body = topicStatsTable.encode();
    response.setBody(body);
    response.setCode(ResponseCode.SUCCESS_VALUE);
    response.setRemark(null);
    return response;
}
 
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:51,代码来源:AdminBrokerProcessor.java


示例17: examineTopicStats

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
/**
 * 查询Topic Offset信息
 * 
 * @param topic
 * @return
 */
public TopicStatsTable examineTopicStats(final String topic) throws RemotingException, MQClientException,
        InterruptedException, MQBrokerException;
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:9,代码来源:MQAdminExt.java


示例18: stats

import com.alibaba.rocketmq.common.admin.TopicStatsTable; //导入依赖的package包/类
TopicStatsTable stats(String topic); 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:2,代码来源:TopicService.java



注:本文中的com.alibaba.rocketmq.common.admin.TopicStatsTable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HeaderViewListener类代码示例发布时间:2022-05-22
下一篇:
Java TextFileInputMeta类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap