简体   繁体   English

使用简单的Apache Camel FTP在轮询时选择目录

[英]Apache Camel FTP using Simple for selecting directories when polling

I would like to be able to retrieve from an FTP which is changing the name of the directory every hour. 我希望能够从每小时更改一次目录名称的FTP检索。 I have the logic to know which is the name of the new directory and it can be passed in using Simple, but I am not sure how to use the options of FTP to achieve this. 我有逻辑知道哪个是新目录的名称,可以使用Simple传递该名称,但是我不确定如何使用FTP选项来实现此目的。

I have tried the following using 2.12.1 but it didn't work: 我已经尝试使用2.12.1进行以下操作,但没有成功:

ftp://myUser@host/${date:now:yyyyMMddHHmm}?password=secret&delay=60s

Is this the correct way to go? 这是正确的方法吗? Thanks! 谢谢!

Try with 试试看

ftp://myUser@host/?fileName=${date:now:yyyyMMddHHmm}&password=secret&delay=60s

eg the ftp/file consumer must be configured with a fixed starting directory. 例如,ftp / file使用者必须配置一个固定的起始目录。 And then an optional file name. 然后是一个可选的文件名。 Though this example will only pickup files that has the current date+time as the name, and without any extension. 尽管此示例将仅提取名称为当前日期和时间且没有任何扩展名的文件。

Though read the docs some more 虽然多读了一些文档

I finally got it working, the trick was setting useList to false. 我终于使它工作了,技巧是将useList设置为false。 Final uri looks like this: 最终uri看起来像这样:

ftp://user@host/fixedPath?password=secret&useList=false&fileName=${date:now:yyyy_MM_dd}/myFile.zip

Thanks for the help guys! 感谢您的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM