本文整理汇总了Java中com.alibaba.rocketmq.client.consumer.store.OffsetStore类的典型用法代码示例。如果您正苦于以下问题:Java OffsetStore类的具体用法?Java OffsetStore怎么用?Java OffsetStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OffsetStore类属于com.alibaba.rocketmq.client.consumer.store包,在下文中一共展示了OffsetStore类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testModify
import com.alibaba.rocketmq.client.consumer.store.OffsetStore; //导入依赖的package包/类
/**
* 测试尝试更新offerset
*/
@Test
public void testModify() {
try {
long l = consumer.fetchConsumeOffset(mq, false);
System.out.println("得到offerset" + l);
//更新offerset
consumer.updateConsumeOffset(mq, l + 1);
OffsetStore offsetStore = consumer.getDefaultMQPullConsumerImpl().getOffsetStore();
offsetStore.persist(mq);
l = consumer.fetchConsumeOffset(mq, false);
System.out.println("更新后的offerset" + l);
} catch (MQClientException e) {
e.printStackTrace();
}
}
示例2: getOffsetStore
import com.alibaba.rocketmq.client.consumer.store.OffsetStore; //导入依赖的package包/类
public OffsetStore getOffsetStore() {
return offsetStore;
}
示例3: setOffsetStore
import com.alibaba.rocketmq.client.consumer.store.OffsetStore; //导入依赖的package包/类
public void setOffsetStore(OffsetStore offsetStore) {
this.offsetStore = offsetStore;
}
示例4: saveOfferSet
import com.alibaba.rocketmq.client.consumer.store.OffsetStore; //导入依赖的package包/类
/**
* 更新offerset
*
* @param offerSet 更新值
* @param offsetStore offsetStore
* @param mq 需要更新的队列
* @throws MQClientException
*/
public void saveOfferSet(long offerSet, OffsetStore offsetStore, MessageQueue mq) throws MQClientException {
System.out.println("当前offerset" + offerSet);
consumer.updateConsumeOffset(mq, offerSet);
offsetStore.persist(mq);
}