public static CoordinatorRecord newGroupEpochRecord(
        String groupId,
        int newGroupEpoch,
        GroupType groupType
    ) {
        if (groupType == GroupType.CONSUMER) {
            return new CoordinatorRecord(
                new ApiMessageAndVersion(
                    new ConsumerGroupMetadataKey()
                        .setGroupId(groupId),
                    (short) 3
                ),
                new ApiMessageAndVersion(
                    new ConsumerGroupMetadataValue()
                        .setEpoch(newGroupEpoch),
                    (short) 0
                )
            );
        } else if (groupType == GroupType.SHARE) {
            return new CoordinatorRecord(
                new ApiMessageAndVersion(
                    new ShareGroupMetadataKey()
                        .setGroupId(groupId),
                    (short) 11
                ),
                new ApiMessageAndVersion(
                    new ShareGroupMetadataValue()
                        .setEpoch(newGroupEpoch),
                    (short) 0
                )
            );
        }
        throw new IllegalArgumentException("Unsupported group type: " + groupType);
    }
Creates a ConsumerGroupMetadata record.

@param groupId       The consumer group id.
@param newGroupEpoch The consumer group epoch.
@return The record.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/CoordinatorRecordHelpers.java