private SortClusterConfig getConfigByClusterName(
            String clusterName,
            List<SortTaskInfo> tasks,
            Map<String, List<StreamSinkEntity>> task2AllStreams,
            Map<String, DataNodeInfo> task2DataNodeMap) {

        List<SortTaskConfig> taskConfigs = tasks.stream()
                .map(task -> {
                    try {
                        String taskName = task.getSortTaskName();
                        String type = task.getSinkType();
                        String dataNodeName = task.getDataNodeName();
                        DataNodeInfo nodeInfo = task2DataNodeMap.get(dataNodeName);
                        List<StreamSinkEntity> streams = task2AllStreams.get(taskName);
                        return SortTaskConfig.builder()
                                .name(taskName)
                                .type(type)
                                .idParams(this.parseIdParams(streams, nodeInfo))
                                .sinkParams(this.parseSinkParams(nodeInfo))
                                .build();
                    } catch (Exception e) {
                        LOGGER.error("fail to parse sort task config of cluster={}", clusterName, e);
                        return null;
                    }
                })
                .filter(Objects::nonNull)
                .collect(Collectors.toList());

        return SortClusterConfig.builder()
                .clusterName(clusterName)
                .sortTasks(taskConfigs)
                .build();
    }
Used to cache the sort cluster config and reduce the number of query to database.
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/SortClusterServiceImpl.java