当前位置: 首页>>代码示例>>Java>>正文


Java GetTopicStatsInfoRequestHeader类代码示例

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


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

示例1: getTopicStatsInfo

import org.apache.rocketmq.common.protocol.header.GetTopicStatsInfoRequestHeader; //导入依赖的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(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), 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:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:21,代码来源:MQClientAPIImpl.java

示例2: getTopicStatsInfo

import org.apache.rocketmq.common.protocol.header.GetTopicStatsInfoRequestHeader; //导入依赖的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(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), 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:apache,项目名称:rocketmq,代码行数:22,代码来源:MQClientAPIImpl.java

示例3: getTopicStatsInfo

import org.apache.rocketmq.common.protocol.header.GetTopicStatsInfoRequestHeader; //导入依赖的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().getMinOffsetInQueue(topic, i);
        if (min < 0)
            min = 0;

        long max = this.brokerController.getMessageStore().getMaxOffsetInQueue(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:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:48,代码来源:AdminBrokerProcessor.java

示例4: getTopicStatsInfo

import org.apache.rocketmq.common.protocol.header.GetTopicStatsInfoRequestHeader; //导入依赖的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:lyy4j,项目名称:rmq4note,代码行数:48,代码来源:AdminBrokerProcessor.java

示例5: getTopicStatsInfo

import org.apache.rocketmq.common.protocol.header.GetTopicStatsInfoRequestHeader; //导入依赖的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().getMinOffsetInQueue(topic, i);
        if (min < 0)
            min = 0;

        long max = this.brokerController.getMessageStore().getMaxOffsetInQueue(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:apache,项目名称:rocketmq,代码行数:49,代码来源:AdminBrokerProcessor.java


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