feyman2016 commented on a change in pull request #8589:
URL: https://github.com/apache/kafka/pull/8589#discussion_r429087133



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
##########
@@ -3621,24 +3640,31 @@ public RemoveMembersFromConsumerGroupResult 
removeMembersFromConsumerGroup(Strin
         KafkaFutureImpl<Map<MemberIdentity, Errors>> future = new 
KafkaFutureImpl<>();
 
         ConsumerGroupOperationContext<Map<MemberIdentity, Errors>, 
RemoveMembersFromConsumerGroupOptions> context =
-            new ConsumerGroupOperationContext<>(groupId, options, deadline, 
future);
+                new ConsumerGroupOperationContext<>(groupId, options, 
deadline, future);
 
+        List<MemberIdentity> members;
+        if (options.removeAll()) {
+            members = getMembersFromGroup(groupId);
+        } else {
+            members = options.members().stream().map(
+                    
MemberToRemove::toMemberIdentity).collect(Collectors.toList());
+        }
         Call findCoordinatorCall = getFindCoordinatorCall(context,
-            () -> getRemoveMembersFromGroupCall(context));
+            () -> getRemoveMembersFromGroupCall(context, members));
         runnable.call(findCoordinatorCall, startFindCoordinatorMs);
 
         return new RemoveMembersFromConsumerGroupResult(future, 
options.members());
     }
 
-    private Call 
getRemoveMembersFromGroupCall(ConsumerGroupOperationContext<Map<MemberIdentity, 
Errors>, RemoveMembersFromConsumerGroupOptions> context) {
+    private Call 
getRemoveMembersFromGroupCall(ConsumerGroupOperationContext<Map<MemberIdentity, 
Errors>,
+            RemoveMembersFromConsumerGroupOptions> context, 
List<MemberIdentity> allMembers) {
         return new Call("leaveGroup",
                         context.deadline(),
                         new ConstantNodeIdProvider(context.node().get().id())) 
{
             @Override
             LeaveGroupRequest.Builder createRequest(int timeoutMs) {
-                return new LeaveGroupRequest.Builder(context.groupId(),
-                                                     
context.options().members().stream().map(
-                                                         
MemberToRemove::toMemberIdentity).collect(Collectors.toList()));
+                    return new LeaveGroupRequest.Builder(context.groupId(),

Review comment:
       Updated




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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


Reply via email to