Reputation: 47
I am busy with an apache camel project that automates the process of uploading a file to a SFTP server every tuesday at 8:00.
I want to set the delay of my apache camel route to: every tuesday at 8:00.
How would i go about doing that?
Let's say 'A' is my pickup location and 'B' is my destination location.
Upvotes: 2
Views: 5811
Reputation: 55550
If you use Apache Camel 2.12 or better then the file consumer (and any other consumer which is scheduler based) has options to use a cron scheduler out of the box, either from spring or quartz2.
I wrote a blog entry about this summarizing about this
Its the scheduler option
And there is some examples at this page, see section QuartzScheduledPollConsumerScheduler
Upvotes: 3
Reputation: 7646
Use the Quartz component as scheduler, pollEnrich for reading the file, and the FTP component for sending its content:
from("quartz://myscheduler?cron=0+0+8+?+*+THU")
.pollEnrich("file:inbox?fileName=data.txt")
.to("ftp://[email protected]:21/?password=pwd")
More information about the cron expression can be found here.
Upvotes: 9
Reputation: 40428
You can generally use the camel-quartz
component like this:
from("quartz://myscheduler?cron=0+0+8+*+*+2")
// do stuff
But on second look, I'm not sure how this would work as an sftp Consumer (can you do from("quartz...").from("sftp...")
in camel? I'm not so sure.
On this thread there is information about how to implement this via a RoutePolicy
.
Good luck.
Upvotes: 0