private ShareGroupMember getOrMaybeSubscribeShareGroupMember(
        ShareGroup group,
        String memberId,
        int memberEpoch,
        boolean createIfNotExists
    ) {
        ShareGroupMember member = group.getOrMaybeCreateMember(memberId, createIfNotExists);
        throwIfShareGroupMemberEpochIsInvalid(member, memberEpoch);
        if (createIfNotExists) {
            log.info("[GroupId {}] Member {} joins the share group using the share protocol.",
                group.groupId(), memberId);
        }
        return member;
    }
Gets or subscribes a new dynamic share group member.

@param group                 The share group.
@param memberId              The member id.
@param memberEpoch           The member epoch.
@param createIfNotExists     Whether the member should be created or not.

@return The existing share group member or a new one.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java