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


Java RollbackStats类代码示例

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


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

示例1: resetOffsetConsumeOffset

import org.apache.rocketmq.common.admin.RollbackStats; //导入依赖的package包/类
private RollbackStats resetOffsetConsumeOffset(String brokerAddr, String consumeGroup, MessageQueue queue, OffsetWrapper offsetWrapper,
    long timestamp, boolean force) throws RemotingException, InterruptedException, MQBrokerException {
    long resetOffset;
    if (timestamp == -1) {

        resetOffset = this.mqClientInstance.getMQClientAPIImpl().getMaxOffset(brokerAddr, queue.getTopic(), queue.getQueueId(), timeoutMillis);
    } else {
        resetOffset =
            this.mqClientInstance.getMQClientAPIImpl().searchOffset(brokerAddr, queue.getTopic(), queue.getQueueId(), timestamp,
                timeoutMillis);
    }

    RollbackStats rollbackStats = new RollbackStats();
    rollbackStats.setBrokerName(queue.getBrokerName());
    rollbackStats.setQueueId(queue.getQueueId());
    rollbackStats.setBrokerOffset(offsetWrapper.getBrokerOffset());
    rollbackStats.setConsumerOffset(offsetWrapper.getConsumerOffset());
    rollbackStats.setTimestampOffset(resetOffset);
    rollbackStats.setRollbackOffset(offsetWrapper.getConsumerOffset());

    if (force || resetOffset <= offsetWrapper.getConsumerOffset()) {
        rollbackStats.setRollbackOffset(resetOffset);
        UpdateConsumerOffsetRequestHeader requestHeader = new UpdateConsumerOffsetRequestHeader();
        requestHeader.setConsumerGroup(consumeGroup);
        requestHeader.setTopic(queue.getTopic());
        requestHeader.setQueueId(queue.getQueueId());
        requestHeader.setCommitOffset(resetOffset);
        this.mqClientInstance.getMQClientAPIImpl().updateConsumerOffset(brokerAddr, requestHeader, timeoutMillis);
    }
    return rollbackStats;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:32,代码来源:DefaultMQAdminExtImpl.java

示例2: resetOffset

import org.apache.rocketmq.common.admin.RollbackStats; //导入依赖的package包/类
public static void resetOffset(DefaultMQAdminExt defaultMQAdminExt, String consumerGroup, String topic,
    long timestamp, boolean force,
    String timeStampStr) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    List<RollbackStats> rollbackStatsList = defaultMQAdminExt.resetOffsetByTimestampOld(consumerGroup, topic, timestamp, force);
    System.out.printf(
        "rollback consumer offset by specified consumerGroup[%s], topic[%s], force[%s], timestamp(string)[%s], timestamp(long)[%s]%n",
        consumerGroup, topic, force, timeStampStr, timestamp);

    System.out.printf("%-20s  %-20s  %-20s  %-20s  %-20s  %-20s%n",
        "#brokerName",
        "#queueId",
        "#brokerOffset",
        "#consumerOffset",
        "#timestampOffset",
        "#rollbackOffset"
    );

    for (RollbackStats rollbackStats : rollbackStatsList) {
        System.out.printf("%-20s  %-20d  %-20d  %-20d  %-20d  %-20d%n",
            UtilAll.frontStringAtLeast(rollbackStats.getBrokerName(), 32),
            rollbackStats.getQueueId(),
            rollbackStats.getBrokerOffset(),
            rollbackStats.getConsumerOffset(),
            rollbackStats.getTimestampOffset(),
            rollbackStats.getRollbackOffset()
        );
    }
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:29,代码来源:ResetOffsetByTimeOldCommand.java

示例3: resetOffset

import org.apache.rocketmq.common.admin.RollbackStats; //导入依赖的package包/类
public static void resetOffset(DefaultMQAdminExt defaultMQAdminExt, String consumerGroup, String topic, long timestamp, boolean force,
    String timeStampStr) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    List<RollbackStats> rollbackStatsList = defaultMQAdminExt.resetOffsetByTimestampOld(consumerGroup, topic, timestamp, force);
    System.out.printf(
        "rollback consumer offset by specified consumerGroup[%s], topic[%s], force[%s], timestamp(string)[%s], timestamp(long)[%s]%n",
        consumerGroup, topic, force, timeStampStr, timestamp);

    System.out.printf("%-20s  %-20s  %-20s  %-20s  %-20s  %-20s%n",
        "#brokerName",
        "#queueId",
        "#brokerOffset",
        "#consumerOffset",
        "#timestampOffset",
        "#rollbackOffset"
    );

    for (RollbackStats rollbackStats : rollbackStatsList) {
        System.out.printf("%-20s  %-20d  %-20d  %-20d  %-20d  %-20d%n",
            UtilAll.frontStringAtLeast(rollbackStats.getBrokerName(), 32),
            rollbackStats.getQueueId(),
            rollbackStats.getBrokerOffset(),
            rollbackStats.getConsumerOffset(),
            rollbackStats.getTimestampOffset(),
            rollbackStats.getRollbackOffset()
        );
    }
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:28,代码来源:ResetOffsetByTimeOldCommand.java

示例4: resetOffsetConsumeOffset

import org.apache.rocketmq.common.admin.RollbackStats; //导入依赖的package包/类
private RollbackStats resetOffsetConsumeOffset(String brokerAddr, String consumeGroup, MessageQueue queue,
    OffsetWrapper offsetWrapper,
    long timestamp, boolean force) throws RemotingException, InterruptedException, MQBrokerException {
    long resetOffset;
    if (timestamp == -1) {

        resetOffset = this.mqClientInstance.getMQClientAPIImpl().getMaxOffset(brokerAddr, queue.getTopic(), queue.getQueueId(), timeoutMillis);
    } else {
        resetOffset =
            this.mqClientInstance.getMQClientAPIImpl().searchOffset(brokerAddr, queue.getTopic(), queue.getQueueId(), timestamp,
                timeoutMillis);
    }

    RollbackStats rollbackStats = new RollbackStats();
    rollbackStats.setBrokerName(queue.getBrokerName());
    rollbackStats.setQueueId(queue.getQueueId());
    rollbackStats.setBrokerOffset(offsetWrapper.getBrokerOffset());
    rollbackStats.setConsumerOffset(offsetWrapper.getConsumerOffset());
    rollbackStats.setTimestampOffset(resetOffset);
    rollbackStats.setRollbackOffset(offsetWrapper.getConsumerOffset());

    if (force || resetOffset <= offsetWrapper.getConsumerOffset()) {
        rollbackStats.setRollbackOffset(resetOffset);
        UpdateConsumerOffsetRequestHeader requestHeader = new UpdateConsumerOffsetRequestHeader();
        requestHeader.setConsumerGroup(consumeGroup);
        requestHeader.setTopic(queue.getTopic());
        requestHeader.setQueueId(queue.getQueueId());
        requestHeader.setCommitOffset(resetOffset);
        this.mqClientInstance.getMQClientAPIImpl().updateConsumerOffset(brokerAddr, requestHeader, timeoutMillis);
    }
    return rollbackStats;
}
 
开发者ID:apache,项目名称:rocketmq,代码行数:33,代码来源:DefaultMQAdminExtImpl.java

示例5: resetOffsetByTimestampOld

import org.apache.rocketmq.common.admin.RollbackStats; //导入依赖的package包/类
public List<RollbackStats> resetOffsetByTimestampOld(String consumerGroup, String topic, long timestamp, boolean force)
    throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    return defaultMQAdminExtImpl.resetOffsetByTimestampOld(consumerGroup, topic, timestamp, force);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:5,代码来源:DefaultMQAdminExt.java

示例6: resetOffsetByTimestampOld

import org.apache.rocketmq.common.admin.RollbackStats; //导入依赖的package包/类
List<RollbackStats> resetOffsetByTimestampOld(String consumerGroup, String topic, long timestamp, boolean force)
throws RemotingException, MQBrokerException, InterruptedException, MQClientException;
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:3,代码来源:MQAdminExt.java

示例7: resetOffsetByTimestampOld

import org.apache.rocketmq.common.admin.RollbackStats; //导入依赖的package包/类
public List<RollbackStats> resetOffsetByTimestampOld(String consumerGroup, String topic, long timestamp,
    boolean force)
    throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    return defaultMQAdminExtImpl.resetOffsetByTimestampOld(consumerGroup, topic, timestamp, force);
}
 
开发者ID:apache,项目名称:rocketmq,代码行数:6,代码来源:DefaultMQAdminExt.java


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