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.");
while (!adminClient.describeConsumerGroup(applicationId, 0).consumers().get().isEmpty()) { Utils.sleep(50); while (!adminClient.describeConsumerGroup(applicationId, 0).consumers().get().isEmpty()) { Utils.sleep(50);
/** * 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); } }
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; }
summary = getAdminClient().describeConsumerGroup(consumerGroup); } catch (IllegalArgumentException | GroupCoordinatorNotAvailableException e) { LOG.debug("Error while attempting to describe consumer group {}", consumerGroup, e);
adminClient.describeConsumerGroup(groupId));
CollectionConvertor.listConvertJavaList(adminClient.describeConsumerGroup(consumerGroup));
CollectionConvertor.listConvertJavaList(adminClient.describeConsumerGroup(consumerGroup));
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()){