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



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
##########
@@ -3623,22 +3641,26 @@ public RemoveMembersFromConsumerGroupResult 
removeMembersFromConsumerGroup(Strin
         ConsumerGroupOperationContext<Map<MemberIdentity, Errors>, 
RemoveMembersFromConsumerGroupOptions> context =
             new ConsumerGroupOperationContext<>(groupId, options, deadline, 
future);
 
-        Call findCoordinatorCall = getFindCoordinatorCall(context,
-            () -> getRemoveMembersFromGroupCall(context));
+        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, members));
         runnable.call(findCoordinatorCall, startFindCoordinatorMs);
 
         return new RemoveMembersFromConsumerGroupResult(future, 
options.members());

Review comment:
       --- If option.members() is empty, it implies that we do a removeAll()
   => Yes, that is correct.
   
   --- hence, should we pass in members into the 
RemoveMembersFromConsumerGroupResult instead of options.members()
   => The members is of type `List<MemberIdentity>` and `MemberIdentity` 
contains field: `memberId` which supports the removal of dynamic members, while 
`options.members()` is of type: `Set<MemberToRemove>`, MemberToRemove only 
supports static member removal specification, in 
RemoveMembersFromConsumerGroupResult we treat similarly like in 
`RemoveMembersFromConsumerGroupOptions`, empty `members` implies `removeAll`,
   we handle it in this way because we think in `non removeAll` scenario we 
would only remove static members, while in `removeAll` scenario we may remove 
both static and dynamic members.




----------------------------------------------------------------
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