public static boolean requiresKnownMemberId(short apiVersion) {
        return apiVersion >= 4;
    }
Since JoinGroupRequest version 4, a client that sends a join group request with
{@link #UNKNOWN_MEMBER_ID} needs to rejoin with a new member id generated
by the server. Once the second join group request is complete, the client is
added as a new member of the group.

Prior to version 4, a client is immediately added as a new member if it sends a
join group request with UNKNOWN_MEMBER_ID.

@param apiVersion The JoinGroupRequest api version.

@return whether a known member id is required or not.
clients/src/main/java/org/apache/kafka/common/requests/JoinGroupRequest.java