org.apache.kafka.clients.consumer.Consumer.paused()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(224)

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

Consumer.paused介绍

暂无

代码示例

代码示例来源:origin: openzipkin/brave

@Override public Set<TopicPartition> paused() {
 return delegate.paused();
}

代码示例来源:origin: linkedin/cruise-control

/**
 * The check if the consumption is done or not. The consumption is done if the consumer has caught up with the
 * log end or all the partitions are paused.
 * @param endOffsets the log end for each partition.
 * @return true if the consumption is done, false otherwise.
 */
private boolean consumptionDone(Map<TopicPartition, Long> endOffsets) {
 Set<TopicPartition> partitionsNotPaused = new HashSet<>(_metricConsumer.assignment());
 partitionsNotPaused.removeAll(_metricConsumer.paused());
 for (TopicPartition tp : partitionsNotPaused) {
  if (_metricConsumer.position(tp) < endOffsets.get(tp)) {
   return false;
  }
 }
 return true;
}

代码示例来源:origin: linkedin/cruise-control

LOG.debug("Starting consuming from metrics reporter topic partitions {}.", _metricConsumer.assignment());
_metricConsumer.resume(_metricConsumer.paused());
int totalMetricsAdded = 0;
long maxTimeStamp = -1L;

代码示例来源:origin: linkedin/li-apache-kafka-clients

@Override
public Set<TopicPartition> paused() {
 return _kafkaConsumer.paused();
}

代码示例来源:origin: io.opentracing.contrib/opentracing-kafka-client

@Override
public Set<TopicPartition> paused() {
 return consumer.paused();
}

代码示例来源:origin: opentracing-contrib/java-kafka-client

@Override
public Set<TopicPartition> paused() {
 return consumer.paused();
}

代码示例来源:origin: rayokota/kafka-graphs

@Override
public Set<TopicPartition> paused() {
  return kafkaConsumer.paused();
}

代码示例来源:origin: io.zipkin.brave/brave-instrumentation-kafka-clients

@Override public Set<TopicPartition> paused() {
 return delegate.paused();
}

代码示例来源:origin: spring-projects/spring-kafka

return null;
}).given(consumer).pause(records.keySet());
given(consumer.paused()).willReturn(records.keySet());
final CountDownLatch resumeLatch = new CountDownLatch(2);
willAnswer(i -> {

代码示例来源:origin: com.cerner.common.kafka/common-kafka

@Override
  public void close() throws IOException {
    // This method does not throw a KafkaException
    if (consumer.paused().contains(topicPartition))
      PAUSED_PARTITIONS.dec();
  }
}

代码示例来源:origin: vert-x3/vertx-kafka-client

@Override
public void paused(Handler<AsyncResult<Set<TopicPartition>>> handler) {
 this.submitTask((consumer, future) -> {
  Set<TopicPartition> result = consumer.paused();
  if (future != null) {
   future.complete(result);
  }
 }, handler);
}

代码示例来源:origin: spring-projects/spring-integration-kafka

return null;
}).given(consumer).pause(anyCollection());
willAnswer(i -> paused.get()).given(consumer).paused();
Map<TopicPartition, List<ConsumerRecord>> records1 = new LinkedHashMap<>();
records1.put(topicPartition, Arrays.asList(
consumer.paused(); // need some other interaction with mock between polls for InOrder
InOrder inOrder = inOrder(consumer, log1, log2);
inOrder.verify(consumer).poll(any(Duration.class));
inOrder.verify(consumer).paused();
inOrder.verify(consumer).poll(any(Duration.class));

代码示例来源:origin: spring-projects/spring-integration-kafka

return null;
}).given(consumer).pause(anyCollection());
willAnswer(i -> paused.get()).given(consumer).paused();
Map<TopicPartition, List<ConsumerRecord>> records1 = new LinkedHashMap<>();
records1.put(topicPartition, Collections.singletonList(
consumer.paused(); // need some other interaction with mock between polls for InOrder
Message<?> received2 = source.receive();
consumer.paused(); // need some other interaction with mock between polls for InOrder
Message<?> received3 = source.receive();
consumer.paused(); // need some other interaction with mock between polls for InOrder
Message<?> received4 = source.receive();
consumer.paused(); // need some other interaction with mock between polls for InOrder
Message<?> received5 = source.receive();
consumer.paused(); // need some other interaction with mock between polls for InOrder
Message<?> received6 = source.receive();
StaticMessageHeaderAccessor.getAcknowledgmentCallback(received3)
inOrder.verify(consumer).subscribe(anyCollection(), any(ConsumerRebalanceListener.class));
inOrder.verify(consumer).poll(any(Duration.class));
inOrder.verify(consumer).paused();
inOrder.verify(consumer).poll(any(Duration.class));
inOrder.verify(consumer).paused();
inOrder.verify(consumer).poll(any(Duration.class));
inOrder.verify(consumer).paused();
inOrder.verify(consumer).poll(any(Duration.class));
inOrder.verify(consumer).paused();
inOrder.verify(consumer).commitSync(Collections.singletonMap(topicPartition, new OffsetAndMetadata(3L)));
inOrder.verify(consumer).commitSync(Collections.singletonMap(topicPartition, new OffsetAndMetadata(6L)));

代码示例来源:origin: spring-projects/spring-integration-kafka

return null;
}).given(consumer).pause(records.keySet());
given(consumer.paused()).willReturn(records.keySet());
final CountDownLatch resumeLatch = new CountDownLatch(1);
willAnswer(i -> {

代码示例来源:origin: spring-projects/spring-integration-kafka

return null;
}).given(consumer).pause(anyCollection());
willAnswer(i -> paused.get()).given(consumer).paused();
Map<TopicPartition, List<ConsumerRecord>> records1 = new LinkedHashMap<>();
records1.put(topicPartition, Arrays.asList(

代码示例来源:origin: spring-projects/spring-integration-kafka

return null;
}).given(consumer).pause(anyCollection());
willAnswer(i -> paused.get()).given(consumer).paused();
Map<TopicPartition, List<ConsumerRecord>> records1 = new LinkedHashMap<>();
records1.put(topicPartition, Arrays.asList(

代码示例来源:origin: reactor/reactor-kafka

@Test
public void consumerMethods() throws Exception {
  testConsumerMethod(c -> assertEquals(this.assignedPartitions, c.assignment()));
  testConsumerMethod(c -> assertEquals(Collections.singleton(topic), c.subscription()));
  testConsumerMethod(c -> assertEquals(2, c.partitionsFor(topics.get(2)).size()));
  testConsumerMethod(c -> assertEquals(topics.size(), c.listTopics().size()));
  testConsumerMethod(c -> assertEquals(0, c.metrics().size()));
  testConsumerMethod(c -> {
    Collection<TopicPartition> partitions = Collections.singleton(new TopicPartition(topic, 1));
    c.pause(partitions);
    assertEquals(partitions, c.paused());
    c.resume(partitions);
  });
  testConsumerMethod(c -> {
    TopicPartition partition = new TopicPartition(topic, 1);
    Collection<TopicPartition> partitions = Collections.singleton(partition);
    long position = c.position(partition);
    c.seekToBeginning(partitions);
    assertEquals(0, c.position(partition));
    c.seekToEnd(partitions);
    assertTrue("Did not seek to end", c.position(partition) > 0);
    c.seek(partition, position);
  });
}

相关文章