dajac commented on code in PR #13644: URL: https://github.com/apache/kafka/pull/13644#discussion_r1187462145
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/generic/GenericGroupMember.java: ########## @@ -0,0 +1,499 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.kafka.coordinator.group.generic; + +import org.apache.kafka.common.message.JoinGroupResponseData; +import org.apache.kafka.common.message.SyncGroupResponseData; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; + +/** + * This class encapsulates a generic group member's metadata. + * + * Member metadata contains the following: + * + * Heartbeat metadata: + * 1. negotiated heartbeat session timeout + * 2. timestamp of the latest heartbeat + * + * Protocol metadata: + * 1. the list of supported protocols (ordered by preference) + * 2. the metadata associated with each protocol + * + * In addition, it also contains the following state information: + * + * 1. Awaiting rebalance callback: when the group is in the prepare-rebalance state, + * its rebalance callback will be kept in the metadata if the + * member has sent the join group request + * 2. Awaiting sync callback: when the group is in the awaiting-sync state, its sync callback + * is kept in metadata until the leader provides the group assignment + * and the group transitions to stable + */ +public class GenericGroupMember { + + private static class MemberSummary { + private final String memberId; + private final Optional<String> groupInstanceId; + private final String clientId; + private final String clientHost; + private final byte[] metadata; + private final byte[] assignment; + + public MemberSummary(String memberId, + Optional<String> groupInstanceId, + String clientId, + String clientHost, + byte[] metadata, + byte[] assignment) { + + this.memberId = memberId; + this.groupInstanceId = groupInstanceId; + this.clientId = clientId; + this.clientHost = clientHost; + this.metadata = metadata; + this.assignment = assignment; + } + + public String memberId() { + return memberId; + } + + public Optional<String> getGroupInstanceId() { + return groupInstanceId; + } + + public String clientId() { + return clientId; + } + + public String clientHost() { + return clientHost; + } + + public byte[] metadata() { + return metadata; + } + + public byte[] assignment() { + return assignment; + } + + } + + /** + * The member id. + */ + private final String memberId; + + /** + * The group instance id. + */ + private final Optional<String> groupInstanceId; + + /** + * The client id. + */ + private final String clientId; Review Comment: It is better to refactor here. It is confusing otherwise. -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org