首页 > 解决方案 > 具有 tempFileName 属性的 Camel 2.23.1 toD(sftp) 正在为每个文件创建一个连接

问题描述

在 Camel 2.23.1 中,我使用带有 SFTP URI 的骆驼“动态到”(toD)来添加动态属性,例如主机、用户名等。这个 URI 包括“tempFileName”属性。

我在此代码示例中看到的内容:

.toD("sftp://${exchangeProperty.username}@${exchangeProperty.host}:${exchangeProperty.port}/${exchangeProperty.folder}"
+ "?privateKeyFile=${exchangeProperty.privatekey}"
+ "&privateKeyPassphrase=${exchangeProperty.keypassphrase}"
+ "&password=${exchangeProperty.password}"
+ "&preferredAuthentications=publickey"
+ "&passiveMode=${exchangeProperty.mode}"
+ "&connectTimeout=${exchangeProperty.timeout_connect}"
+ "&soTimeout=${exchangeProperty.timeout_socket}"
+ "&timeout=${exchangeProperty.timeout_read}"
+ "&tempFileName=inprogress.${file:name}.filepart"
+ "&stepwise=${exchangeProperty.stepwise}"
+ "&fastExistsCheck=${exchangeProperty.fastExistsCheck}"
)

它为每个文件创建一个连接,这不是我想要实现的。

但是,如果我评论或删除“tempFileName”部分,它只需要一个有限的连接池。如果我使用一个简单的端点(to),它也可以工作,有或没有“tempFileName”属性。

我想为每个动态端点(所以没有disconnect)保留一个连接池,并在上传时定义一个临时文件名。对于文件名,我们通常使用诸如 Exchange.FILE_NAME 和/或 Exchange.FILE_NAME_ONLY 之类的标题,但我没有看到它用于临时文件名。

有人可以帮我吗?

标签: javaapache-camelcamel-ftp

解决方案


推荐阅读