本文整理了Java中com.pinterest.secor.common.ZookeeperConnector.getCommittedOffsetCount()
方法的一些代码示例,展示了ZookeeperConnector.getCommittedOffsetCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperConnector.getCommittedOffsetCount()
方法的具体详情如下:
包路径:com.pinterest.secor.common.ZookeeperConnector
类名称:ZookeeperConnector
方法名:getCommittedOffsetCount
暂无
代码示例来源:origin: pinterest/secor
public void testDeleteTopicPartition() throws Exception {
Mockito.when(
mZookeeperConnector.getCommittedOffsetCount(mTopicPartition))
.thenReturn(31L);
Mockito.when(
mOffsetTracker.setCommittedOffsetCount(mTopicPartition, 30L))
.thenReturn(11L);
Mockito.when(mOffsetTracker.getLastSeenOffset(mTopicPartition))
.thenReturn(20L);
mUploader.applyPolicy(false);
Mockito.verify(mFileRegistry).deleteTopicPartition(mTopicPartition);
}
代码示例来源:origin: pinterest/secor
@Override
public Message getCommittedMessage(TopicPartition topicPartition) throws Exception {
SimpleConsumer consumer = null;
try {
long committedOffset = mZookeeperConnector.getCommittedOffsetCount(topicPartition) - 1;
if (committedOffset < 0) {
return null;
}
consumer = createConsumer(topicPartition);
if (consumer == null) {
return null;
}
return getMessage(topicPartition, committedOffset, consumer);
} catch (MessageDoesNotExistException e) {
// If a RuntimeEMessageDoesNotExistException exception is raised,
// the message at the last comitted offset does not exist in Kafka.
// This is usually due to the message being compacted away by the
// Kafka log compaction process.
//
// That is no an exceptional situation - in fact it can be normal if
// the topic being consumed by Secor has a low volume. So in that
// case, simply return null
LOG.warn("no committed message for topic {} partition {}", topicPartition.getTopic(), topicPartition.getPartition());
return null;
} finally {
if (consumer != null) {
consumer.close();
}
}
}
代码示例来源:origin: pinterest/secor
try {
long zookeeperCommittedOffsetCount = mZookeeperConnector.getCommittedOffsetCount(
topicPartition);
if (zookeeperCommittedOffsetCount == committedOffsetCount) {
代码示例来源:origin: pinterest/secor
public void testTrimFiles() throws Exception {
Mockito.when(
mZookeeperConnector.getCommittedOffsetCount(mTopicPartition))
.thenReturn(21L);
代码示例来源:origin: pinterest/secor
public void testUploadFiles() throws Exception {
Mockito.when(
mZookeeperConnector.getCommittedOffsetCount(mTopicPartition))
.thenReturn(11L);
Mockito.when(
代码示例来源:origin: pinterest/secor
modificationAgeSec >= mConfig.getMaxFileAgeSeconds() ||
isRequiredToUploadAtTime(topicPartition)) {
long newOffsetCount = mZookeeperConnector.getCommittedOffsetCount(topicPartition);
long oldOffsetCount = mOffsetTracker.setCommittedOffsetCount(topicPartition,
newOffsetCount);
内容来源于网络,如有侵权,请联系作者删除!