public static long createProcessDef(String url, String token, String name, String desc,
            long taskCode, String inlongManagerUrl, String username, String password, long offset, String groupId)
            throws Exception {
        try {
            Map<String, String> header = buildHeader(token);

            DSTaskRelation taskRelation = new DSTaskRelation();
            taskRelation.setPostTaskCode(taskCode);
            String taskRelationJson = MAPPER.writeValueAsString(Collections.singletonList(taskRelation));

            DSTaskParams taskParams = new DSTaskParams();
            taskParams.setRawScript(buildScript(inlongManagerUrl, username, password, offset, groupId));

            DSTaskDefinition taskDefinition = new DSTaskDefinition();
            taskDefinition.setCode(taskCode);
            taskDefinition.setName(DS_DEFAULT_TASK_NAME);
            taskDefinition.setDescription(DS_DEFAULT_TASK_DESC);
            taskDefinition.setTaskParams(taskParams);
            String taskDefinitionJson = MAPPER.writeValueAsString(Collections.singletonList(taskDefinition));

            Map<String, String> queryParams = new HashMap<>();
            queryParams.put(DS_TASK_RELATION, taskRelationJson);
            queryParams.put(DS_TASK_DEFINITION, taskDefinitionJson);
            queryParams.put(DS_PROCESS_NAME, name);
            queryParams.put(DS_PROCESS_DESC, desc);

            JsonObject data = executeHttpRequest(url, POST, queryParams, header);

            LOGGER.info("create process definition success, process definition data: {}", data);
            return data != null ? data.get(DS_RESPONSE_DATA).getAsJsonObject().get(DS_CODE).getAsLong() : 0;
        } catch (JsonParseException e) {
            LOGGER.error("JsonParseException during creating process definition", e);
            throw new DolphinScheduleException(
                    JSON_PARSE_ERROR,
                    String.format("Error creating process definition with name: %s and description: %s at URL: %s",
                            name, desc, url));

        } catch (DolphinScheduleException e) {
            throw new DolphinScheduleException(
                    PROCESS_DEFINITION_CREATION_FAILED,
                    String.format("Error creating process definition with name: %s and description: %s at URL: %s",
                            name, desc, url));
        }
    }
Creates a process definition in DolphinScheduler.

@param url               The base URL of the DolphinScheduler API.
@param token             The authentication token to be used in the request header.
@param name              The name of the process definition.
@param desc              The description of the process definition.
@param taskCode          The task code to be associated with this process definition.
@param inlongManagerUrl  The host where the process will run.
@param username          The username for authentication.
@param password          The password for authentication.
@param offset            The offset for the scheduling.
@param groupId           The group ID of the process.
@return The process definition code (ID) if creation is successful, or 0 if an error occurs.
inlong-manager/manager-schedule/src/main/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleUtils.java