Search in sources :

Example 1 with ArchiveException

use of com.alibaba.otter.node.etl.common.pipe.impl.http.archive.ArchiveException in project otter by alibaba.

the class RemoteUrlBuilder method getUrl.

public String getUrl(Long pipelineId, String filePath) {
    Node node = configClientService.currentNode();
    Pipeline pipeline = configClientService.findPipeline(pipelineId);
    String ip = node.getIp();
    if (node.getParameters().getUseExternalIp() || pipeline.getParameters().getUseExternalIp()) {
        ip = node.getParameters().getExternalIp();
        if (StringUtils.isEmpty(ip)) {
            throw new ArchiveException(String.format("pipelineId:%s useExternalIp by nid[%s] has no external ip", String.valueOf(pipelineId), String.valueOf(node.getId())));
        }
    }
    // 注意为其下载端口
    Integer port = node.getParameters().getDownloadPort();
    if (port == null || port < 0) {
        port = defaultDownloadPort;
    }
    return MessageFormat.format(urlFormat, ip, String.valueOf(port), filePath);
}
Also used : Node(com.alibaba.otter.shared.common.model.config.node.Node) ArchiveException(com.alibaba.otter.node.etl.common.pipe.impl.http.archive.ArchiveException) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Aggregations

ArchiveException (com.alibaba.otter.node.etl.common.pipe.impl.http.archive.ArchiveException)1 Node (com.alibaba.otter.shared.common.model.config.node.Node)1 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)1