[jira] [Commented] (KAFKA-6058) KIP-222: Add "describe consumer groups" and "list consumer groups" to KafkaAdminClient

2018-04-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-6058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16438777#comment-16438777
 ] 

ASF GitHub Bot commented on KAFKA-6058:
---

guozhangwang closed pull request #4856: KAFKA-6058: Refactor consumer API 
result return types
URL: https://github.com/apache/kafka/pull/4856
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/clients/src/main/java/org/apache/kafka/clients/admin/DeleteConsumerGroupsResult.java
 
b/clients/src/main/java/org/apache/kafka/clients/admin/DeleteConsumerGroupsResult.java
index b4bce264405..dd6835cf10c 100644
--- 
a/clients/src/main/java/org/apache/kafka/clients/admin/DeleteConsumerGroupsResult.java
+++ 
b/clients/src/main/java/org/apache/kafka/clients/admin/DeleteConsumerGroupsResult.java
@@ -29,13 +29,24 @@
  */
 @InterfaceStability.Evolving
 public class DeleteConsumerGroupsResult {
-final KafkaFuture> futures;
+private final Map futures;
 
-DeleteConsumerGroupsResult(KafkaFuture> 
futures) {
+DeleteConsumerGroupsResult(final Map futures) {
 this.futures = futures;
 }
 
-public KafkaFuture> deletedGroups() {
+/**
+ * Return a map from group id to futures which can be used to check the 
status of
+ * individual deletions.
+ */
+public Map deletedGroups() {
 return futures;
 }
+
+/**
+ * Return a future which succeeds only if all the consumer group deletions 
succeed.
+ */
+public KafkaFuture all() {
+return KafkaFuture.allOf(futures.values().toArray(new KafkaFuture[0]));
+}
 }
diff --git 
a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeConsumerGroupsResult.java
 
b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeConsumerGroupsResult.java
index adde031b678..ac2189cc6dc 100644
--- 
a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeConsumerGroupsResult.java
+++ 
b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeConsumerGroupsResult.java
@@ -32,16 +32,23 @@
 @InterfaceStability.Evolving
 public class DescribeConsumerGroupsResult {
 
-private final KafkaFuture> futures;
+private final Map futures;
 
-public DescribeConsumerGroupsResult(KafkaFuture> futures) {
+public DescribeConsumerGroupsResult(final Map futures) {
 this.futures = futures;
 }
 
 /**
- * Return a map from group name to futures which can be used to check the 
description of a consumer group.
+ * Return a map from group id to futures which can be used to check the 
description of a consumer group.
  */
-public KafkaFuture> 
describedGroups() {
+public Map 
describedGroups() {
 return futures;
 }
+
+/**
+ * Return a future which succeeds only if all the consumer group 
description succeed.
+ */
+public KafkaFuture all() {
+return KafkaFuture.allOf(futures.values().toArray(new KafkaFuture[0]));
+}
 }
diff --git 
a/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java 
b/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
index 50bcfd38856..fa3f943555b 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
@@ -46,6 +46,7 @@
 import org.apache.kafka.common.errors.AuthenticationException;
 import org.apache.kafka.common.errors.BrokerNotAvailableException;
 import org.apache.kafka.common.errors.DisconnectException;
+import org.apache.kafka.common.errors.InvalidGroupIdException;
 import org.apache.kafka.common.errors.InvalidRequestException;
 import org.apache.kafka.common.errors.InvalidTopicException;
 import org.apache.kafka.common.errors.RetriableException;
@@ -53,6 +54,7 @@
 import org.apache.kafka.common.errors.UnknownServerException;
 import org.apache.kafka.common.errors.UnsupportedVersionException;
 import org.apache.kafka.common.internals.KafkaFutureImpl;
+import org.apache.kafka.common.internals.Topic;
 import org.apache.kafka.common.metrics.JmxReporter;
 import org.apache.kafka.common.metrics.MetricConfig;
 import org.apache.kafka.common.metrics.Metrics;
@@ -916,8 +918,11 @@ private void failCalls(long now, List calls, 
AuthenticationException authe
  * @param correlationIdToCall   A map of correlation IDs to calls.
  * @param callsInFlight A map of nodes to the calls they have 
in flight.
   

[jira] [Commented] (KAFKA-6058) KIP-222: Add "describe consumer groups" and "list consumer groups" to KafkaAdminClient

2018-04-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-6058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16434791#comment-16434791
 ] 

ASF GitHub Bot commented on KAFKA-6058:
---

guozhangwang opened a new pull request #4856: KAFKA-6058: Refactor consumer API 
result return types
URL: https://github.com/apache/kafka/pull/4856
 
 
   Refactored the return types in consumer group APIs the following way:
   
   ```
   Map 
DeleteConsumerGroupsResult#deletedGroups()
   
   Map 
DescribeConsumerGroupsResult#describedGroups()
   
   KafkaFuture 
ListConsumerGroupsResult#listings()
   
   KafkaFuture> 
ListConsumerGroupOffsetsResult#partitionsToOffsetAndMetadata()
   ```
   
   1. For DeleteConsumerGroupsResult and DescribeConsumerGroupsResult, for each 
group id we have two round-trips to get the coordinator, and then send the 
delete / describe request; I leave the potential optimization of batching 
requests for future work.
   
   2. For ListConsumerGroupOffsetsResult, it is a simple single round-trip and 
hence the whole map is wrapped as a Future.
   
   3. ListConsumerGroupsResult, it is the most tricky one: we would only know 
how many futures we should wait for after the first listNode returns, and hence 
I constructed the flattened future in the middle wrapped with the underlying 
map of futures.
   
   3.a Another big change I made is, we do not return the exception in the 
flattened future if only a few of the nodes returns ERROR code, and instead 
just return the rest of the listings; to use that I added a new `anyOf` 
function in `KafkaFuture`.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> KIP-222: Add "describe consumer groups" and "list consumer groups" to 
> KafkaAdminClient
> --
>
> Key: KAFKA-6058
> URL: https://issues.apache.org/jira/browse/KAFKA-6058
> Project: Kafka
>  Issue Type: Improvement
>  Components: clients
>Reporter: Matthias J. Sax
>Assignee: Jorge Quilcate
>Priority: Major
>  Labels: kip-222
> Fix For: 1.2.0
>
>
> {{KafkaAdminClient}} does not allow to get information about consumer groups. 
> This feature is supported by old {{kafka.admin.AdminClient}} though.
> We should add {{KafkaAdminClient#describeConsumerGroups()}} and 
> {{KafkaAdminClient#listConsumerGroup()}}.
> Associated KIP: KIP-222



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KAFKA-6058) KIP-222: Add "describe consumer groups" and "list consumer groups" to KafkaAdminClient

2018-01-23 Thread Jeff Widman (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-6058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16336639#comment-16336639
 ] 

Jeff Widman commented on KAFKA-6058:


Note that listing group offsets has also been added to KIP-222

> KIP-222: Add "describe consumer groups" and "list consumer groups" to 
> KafkaAdminClient
> --
>
> Key: KAFKA-6058
> URL: https://issues.apache.org/jira/browse/KAFKA-6058
> Project: Kafka
>  Issue Type: Improvement
>  Components: clients
>Reporter: Matthias J. Sax
>Assignee: Jorge Quilcate
>Priority: Major
>  Labels: needs-kip
>
> {{KafkaAdminClient}} does not allow to get information about consumer groups. 
> This feature is supported by old {{kafka.admin.AdminClient}} though.
> We should add {{KafkaAdminClient#describeConsumerGroups()}} and 
> {{KafkaAdminClient#listConsumerGroup()}}.
> Associated KIP: KIP-222



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)