我在Apache Camel配置中使用了以下内容:
<camel:route errorHandlerRef="loggingErrorHandler" id="ROUTE_ICL">
<camel:from uri="file:{{camel.route.icl.from.file.path}}?filter=#fileFilterMAVRO&initialDelay={{camel.route.from.file.initialDelay}}&delay={{camel.route.from.file.delay}}&useFixedDelay=true&runLoggingLevel=TRACE&startingDirectoryMustExist={{camel.route.from.file.startingDirectoryMustExist}}&autoCreate={{camel.route.from.file.autoCreate}}&maxMessagesPerPoll={{camel.route.from.file.maxMessagesPerPoll}}&eagerMaxMessagesPerPoll=true&delete=false&readLock=idempotent&readLockLoggingLevel=OFF&readLockRemoveOnRollback=false&readLockRemoveOnCommit=false&idempotent=true&idempotentKey=${file:onlyname}&idempotentRepository=#iclMessageIdRepository&recursive=false&move={{camel.route.icl.complete.file.path}}&moveFailed={{camel.route.icl.failed.file.path}}" />
<camel:to uri="sftp://user1@ecomt199.qintra.com:22/nas/tst2/inputfiles?password=Pass1234&runLoggingLevel=TRACE"/>
</camel:route>现在这起作用了。它能传送我的文件。
问题是我希望我的文件位于:/nas/tst2 2/inputfile。但是它的位置是:/home/user1 1/nas/tst2 2/inputfile
现在,我如何才能在/nas/ tst2 2 / inputfiles上运行它呢?/nas/和/home/都在/上。
问题是更改默认/home/。
我可以使用哪个属性?我无法找到或理解如何在骆驼DSL中这样做。
发布于 2017-08-22 08:03:52
在当前版本中,Camel确实不允许完全限定路径。但是,只要用户拥有特权,就可以使用这样的路径作为解决办法:
../../../../../../../../this_is_the_root_folder/usr/....您基本上从用户的目录开始,然后在树中向上,直到到达根目录。您只需确保添加了足够多的../../即可到达根目录。
这不是最好的解决办法,但它很简单,并为我工作。
发布于 2017-08-19 07:33:40
我不认为最好的解决方案是在骆驼DSL。用于SFTP的用户的根目录位于主目录中。
我认为一个好的解决方案是使用正确的根目录配置FTP服务器中的另一个用户,您希望在其中放置文件。
发布于 2017-08-20 15:48:19
不能。当前的camel-ftp实现特别不允许完全限定路径。所有路径都相对于用户的主目录。
为了在我的项目中解决这个问题,我对组件进行了分叉,并删除了去掉前面路径分隔符字符的代码。
https://stackoverflow.com/questions/45759853
复制相似问题