Routes don't start when the context starts, *by default* they start when the route starts because of the default value of the 'autoStartup' attribute. One quick solution would be to autostart="false" [1] and use the message to direct to start your ftp route at appropriate times. You can self stop after processing the desired number of messages/files for instance.

Good luck,
Hadrian

[1] http://camel.apache.org/configuring-route-startup-ordering-and-autostartup.html


On 02/04/2014 10:33 AM, mister blinky wrote:
Thanks ... I need to invoke and ftp transfer as part of a flow of processing.
Here is the flow

1) jetty server gets hit and the url contains status=SUCCEEDED
2) ssh gets invoked to run a shell script that moves processed files to a
given directory -- call it "fooDirectory"
3) ftp gets invoked to move the file called "foo" in "fooDirectory" to the
local machine.

All works well except (3) for these reasons

a) The directory "fooDirectory" will not exist until (2) runs
b) The from("ftp:...).to("file:...) in the 3rd step is polling and gets
invoked when there is no "fooDirectory" since the dir is created in step (2)
and thus throws an error everytime it runs when the "fooDirectory" doesn't
exist. (I've set a long consumer.delay=60000 to work around this a bit, but
it's ugly.)

So what I want to do is have the from("ftp:...").to("file:...")  only get
invoked when step (2) is done. To do this, I have step (2) end with a
to("direct:goGetTheFile"). Then, step (3) is basically

from("direct:goGetTheFile")
.from("ftp:...")
.to("file:...)

This works. But the from("ftp:...") is considered a distinct route, so gets
invoked and starts polling as soon as the camelContext is started. Thus it
throws a "File operation failed: 550 Failed to change directory" until the
directory exists -- i.e., until step (2) runs.

I hope this is clear and explains why my question is "Can you configure ftp
to check ONLY when invoked via a direct?"




--
View this message in context: 
http://camel.465427.n5.nabble.com/Basic-from-fp-to-file-route-Need-clarification-1M-Thanks-tp4950632p5746799.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to