kafka.admin.AdminClient.describeConsumerGroup()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(273)

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

AdminClient.describeConsumerGroup介绍

暂无

代码示例

代码示例来源:origin: org.apache.kafka/kafka_2.10

if (!adminClient.describeConsumerGroup(groupId).consumers().get().isEmpty()) {
  throw new IllegalStateException("Consumer group '" + groupId + "' is still active. " +
    "Make sure to stop all running application instances before running the reset tool.");

代码示例来源:origin: confluentinc/kafka-streams-examples

while (!adminClient.describeConsumerGroup(applicationId, 0).consumers().get().isEmpty()) {
 Utils.sleep(50);
while (!adminClient.describeConsumerGroup(applicationId, 0).consumers().get().isEmpty()) {
 Utils.sleep(50);

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

/**
 * Retrieves the {@link AdminClient.ConsumerGroupSummary} information from Kafka
 *
 * @param consumerGroup
 *      the name of the consumer group
 * @return the {@link AdminClient.ConsumerGroupSummary} information from Kafka
 * @throws AdminOperationException
 *      if there is an issue retrieving the consumer group summary
 */
public AdminClient.ConsumerGroupSummary getConsumerGroupSummary(String consumerGroup) {
  if (StringUtils.isBlank(consumerGroup))
    throw new IllegalArgumentException("consumerGroup cannot be null, empty or blank");
  try {
    return getAdminClient().describeConsumerGroup(consumerGroup);
  } catch (KafkaException e) {
    throw new AdminOperationException("Unable to retrieve summary for consumer group: " + consumerGroup, e);
  }
}

代码示例来源:origin: gnuhpc/Kafka-zk-restapi

private Set<String> listNewConsumerGroupsByTopic(@TopicExistConstraint String topic) {
 Set<String> result = new HashSet();
 Set<String> consumersList = listAllNewConsumerGroups();
 for (String c : consumersList) {
  AdminClient adminClient = kafkaUtils.createAdminClient();
  List<AdminClient.ConsumerSummary> consumerSummaryList =
    CollectionConvertor.listConvertJavaList(adminClient.describeConsumerGroup(c));
  Set<String> topicSet =
    consumerSummaryList
      .stream()
      .flatMap(cs -> CollectionConvertor.listConvertJavaList(cs.assignment()).stream())
      .map(TopicPartition::topic)
      .filter(t -> t.equals(topic))
      .distinct()
      .collect(toSet());
  if (topicSet.size() != 0) {
   result.add(c);
  }
  adminClient.close();
 }
 return result;
}

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

summary = getAdminClient().describeConsumerGroup(consumerGroup);
} catch (IllegalArgumentException | GroupCoordinatorNotAvailableException e) {
  LOG.debug("Error while attempting to describe consumer group {}", consumerGroup, e);

代码示例来源:origin: stackoverflow.com

adminClient.describeConsumerGroup(groupId));

代码示例来源:origin: gnuhpc/Kafka-zk-restapi

CollectionConvertor.listConvertJavaList(adminClient.describeConsumerGroup(consumerGroup));

代码示例来源:origin: gnuhpc/Kafka-zk-restapi

CollectionConvertor.listConvertJavaList(adminClient.describeConsumerGroup(consumerGroup));

代码示例来源:origin: vakinge/jeesuite-libs

public ConsumerGroupInfo consumerGroup(KafkaConsumer<String, Serializable> kafkaConsumer,String group){
  ConsumerGroupSummary groupSummary = adminClient.describeConsumerGroup(group,30000);
  scala.collection.immutable.List<ConsumerSummary> consumers = groupSummary.consumers().get();
  if(consumers.isEmpty()){

相关文章