Skip to content

Commit aaa4460

Browse files
authored
Use new consumer group admin APIs (#411)
1 parent 41826c3 commit aaa4460

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

streams-bootstrap-core/src/main/java/com/bakdata/kafka/admin/ConsumerGroupsClient.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* MIT License
33
*
4-
* Copyright (c) 2025 bakdata
4+
* Copyright (c) 2026 bakdata
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -34,11 +34,11 @@
3434
import lombok.extern.slf4j.Slf4j;
3535
import org.apache.kafka.clients.admin.Admin;
3636
import org.apache.kafka.clients.admin.ConsumerGroupDescription;
37-
import org.apache.kafka.clients.admin.ConsumerGroupListing;
3837
import org.apache.kafka.clients.admin.DeleteConsumerGroupsResult;
3938
import org.apache.kafka.clients.admin.DescribeConsumerGroupsResult;
39+
import org.apache.kafka.clients.admin.GroupListing;
4040
import org.apache.kafka.clients.admin.ListConsumerGroupOffsetsResult;
41-
import org.apache.kafka.clients.admin.ListConsumerGroupsResult;
41+
import org.apache.kafka.clients.admin.ListGroupsResult;
4242
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
4343
import org.apache.kafka.common.KafkaFuture;
4444
import org.apache.kafka.common.TopicPartition;
@@ -61,8 +61,8 @@ public final class ConsumerGroupsClient {
6161
*
6262
* @return consumer groups
6363
*/
64-
public Collection<ConsumerGroupListing> list() {
65-
final ListConsumerGroupsResult result = this.adminClient.listConsumerGroups();
64+
public Collection<GroupListing> list() {
65+
final ListGroupsResult result = this.adminClient.listGroups();
6666
return this.timeout.get(result.all(), () -> "Failed to list consumer groups");
6767
}
6868

@@ -142,7 +142,7 @@ public Map<TopicPartition, OffsetAndMetadata> listOffsets() {
142142
* @return whether a Kafka consumer group with the specified name exists or not
143143
*/
144144
public boolean exists() {
145-
final Collection<ConsumerGroupListing> consumerGroups = ConsumerGroupsClient.this.list();
145+
final Collection<GroupListing> consumerGroups = ConsumerGroupsClient.this.list();
146146
return consumerGroups.stream()
147147
.anyMatch(this::isThisGroup);
148148
}
@@ -170,7 +170,7 @@ public ConfigClient config() {
170170
new ConfigResource(Type.GROUP, this.groupName));
171171
}
172172

173-
private boolean isThisGroup(final ConsumerGroupListing listing) {
173+
private boolean isThisGroup(final GroupListing listing) {
174174
return listing.groupId().equals(this.groupName);
175175
}
176176

0 commit comments

Comments
 (0)