本文整理匯總了Java中org.apache.rocketmq.common.admin.RollbackStats.setConsumerOffset方法的典型用法代碼示例。如果您正苦於以下問題:Java RollbackStats.setConsumerOffset方法的具體用法?Java RollbackStats.setConsumerOffset怎麽用?Java RollbackStats.setConsumerOffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.rocketmq.common.admin.RollbackStats
的用法示例。
在下文中一共展示了RollbackStats.setConsumerOffset方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例2: 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;
}