You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/11/21 22:07:42 UTC

[GitHub] [kafka] jolshan commented on a diff in pull request #12850: KAFKA-14367; Add `LeaveGroup` to the new `GroupCoordinator` interface

jolshan commented on code in PR #12850:
URL: https://github.com/apache/kafka/pull/12850#discussion_r1028558389


##########
clients/src/main/java/org/apache/kafka/common/requests/LeaveGroupResponse.java:
##########
@@ -55,6 +56,22 @@ public LeaveGroupResponse(LeaveGroupResponseData data) {
         this.data = data;
     }
 
+    public LeaveGroupResponse(LeaveGroupResponseData data, short version) {
+        super(ApiKeys.LEAVE_GROUP);
+
+        if (version >= 3) {
+            this.data = data;
+        } else {
+            if (data.members().size() != 1) {
+                throw new UnsupportedVersionException("LeaveGroup response version " + version +
+                    " can only contain one member, got " + data.members().size() + " members.");
+            }
+
+            this.data = new LeaveGroupResponseData()

Review Comment:
   This seems to be normalizing the response? Seems like we just need to set the error code, but its done in a way that's a little confusing. Why do we need to getError when we have the data.errorCode?



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

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org