lucasbru commented on code in PR #19114: URL: https://github.com/apache/kafka/pull/19114#discussion_r1981491718
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/StreamsGroup.java: ########## @@ -355,6 +355,32 @@ public StreamsGroupMember getOrMaybeCreateMember( return new StreamsGroupMember.Builder(memberId).build(); } + /** + * Gets or creates a new member but without adding it to the group. Adding a member is done via the + * {@link StreamsGroup#updateMember(StreamsGroupMember)} method. + * + * @param memberId The member ID. + * @param createIfNotExists Booleans indicating whether the member must be created if it does not exist. + * @return A StreamsGroupMember. + */ + public StreamsGroupMember getOrMaybeCreateDefaultMember( + String memberId, + boolean createIfNotExists + ) throws UnknownMemberIdException { + StreamsGroupMember member = members.get(memberId); + if (member != null) { + return member; + } + + if (!createIfNotExists) { + throw new UnknownMemberIdException( + String.format("Member %s is not a member of group %s.", memberId, groupId) + ); + } + + return StreamsGroupMember.Builder.withDefaults(memberId).build(); Review Comment: The heartbeat relies on having various defaults (such as empty sets for tasksWithRevocations), that got replaced by null in a refactoring. That's why I had to introduce `withDefaults`. -- 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