gpt4 book ai didi

com.pinterest.secor.common.ZookeeperConnector.getCommittedOffsetCount()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 11:12:12 26 4
gpt4 key购买 nike

本文整理了Java中com.pinterest.secor.common.ZookeeperConnector.getCommittedOffsetCount()方法的一些代码示例,展示了ZookeeperConnector.getCommittedOffsetCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperConnector.getCommittedOffsetCount()方法的具体详情如下:
包路径:com.pinterest.secor.common.ZookeeperConnector
类名称:ZookeeperConnector
方法名:getCommittedOffsetCount

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);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com