Reputation: 59
On a same SFTP location, there are day wise structure as bellow.
Folowing route is working fine and each 30S the consumer checks the SFTP location and downloads .txt files.
from("sftp://user@host?antInclude=*/*/*/*.txt"
+ "&password=xxx" + "&recursive=true" + "&idempotent=true"
+ "&scheduler=spring&scheduler.cron=0/30+*+*+*+*+?")
.to("file:/home/user/data");
But above route will scan ALL the directories in the SFTP location and it MAY be a performance issue. So I need to scan only for today and previous day like bellow.
from("sftp://user@host?antInclude=2014/07/03/*.txt,2014/07/02/*.txt"
+ "&password=xxx" + "&recursive=true" + "&idempotent=true"
+ "&scheduler=spring&scheduler.cron=0/30+*+*+*+*+?")
.to("file:/home/user/data");
But, I need to use dynamic directory pattern for antInclude=
option. I am trying with several approaches but it was not success. Can you please give me an idea with your experience.
Upvotes: 1
Views: 1067
Reputation: 7636
The source endpoint is not dynamic. If you need to change it, process as described here. So, one possible solution could be to use a scheduler to update the route every day. Not very elegant, I know.
Upvotes: 0