Re: Basic from fp to file route: Need clarification. 1M Thanks.
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=6 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.
Re: Basic from fp to file route: Need clarification. 1M Thanks.
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=6 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.
Re: Basic from fp to file route: Need clarification. 1M Thanks.
Please rephrase your question. You cannot have 2 from's in a route. A from sets up a consumer which is kinda the listener for messages to be processed on the route. The ftp consumer continuously looks for new files to be processed on a ftp server, but depending on the application you may have or want to process one or more files at a time. Describing your problem gives you better chances to get useful help. Hadrian On 02/04/2014 09:08 AM, mister blinky wrote: Can you configure ftp to check ONLY when invoked via a direct? That is from("direct:checkForFiles") .from("ftp:...") such that the from("ftp:...) is ONLY invoked when the from("direct:...") is invoked? thank you. -- View this message in context: http://camel.465427.n5.nabble.com/Basic-from-fp-to-file-route-Need-clarification-1M-Thanks-tp4950632p5746785.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Basic from fp to file route: Need clarification. 1M Thanks.
Can you configure ftp to check ONLY when invoked via a direct? That is from("direct:checkForFiles") .from("ftp:...") such that the from("ftp:...) is ONLY invoked when the from("direct:...") is invoked? thank you. -- View this message in context: http://camel.465427.n5.nabble.com/Basic-from-fp-to-file-route-Need-clarification-1M-Thanks-tp4950632p5746785.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Basic from fp to file route: Need clarification. 1M Thanks.
Hi You can provide the name of the file to download as a parameter to the ftp uri. "ftp://localhost/testfolder/?username=MYUSERNAME&password=MYPASSWORD&localWorkDirectory=/tmp&binary=true?fileName=soap.xml"; Then you do not need to use the choice. The Camel FTP consumer (eg when you do from("ftp:...") will keep checking the FTP server for new files to download. You can configure how often it checks by setting an option named: delay and its in milliseconds delay=5000 = 5 seconds But you can also use a more human readable format by specifying delay=5m = 5 minutes delay=10s = 10 seconds delay=1h = 1 hour And so forth. Also check this FAQ about running Camel standalone https://cwiki.apache.org/confluence/display/CAMEL/Running+Camel+standalone+and+have+it+keep+running On Sun, Oct 30, 2011 at 8:20 PM, H Paul wrote: > "The journey of 1000 miles begin with 1 step." This is my first small step > with Camel. > > 1. Basically, I want to selectively download only 1 file soap.xml by ftp. Is > below code is correct way of doing it? Please see code + log > 2. From log, I saw a lot of repeative things. Is it because of 5 min? > What is the correct value? 5 to 60 mins? > > int min=5; > int second=60; > context.start(); > Thread.sleep(min*second*1000); > context.stop(); > > 3. How can we stop the process once the file soap.xml is downloaded? there > is no need to wait for 5 mins. > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Basic-from-fp-to-file-route-Need-clarification-1M-Thanks-tp4950632p4950632.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Basic from fp to file route: Need clarification. 1M Thanks.
"The journey of 1000 miles begin with 1 step." This is my first small step with Camel. 1. Basically, I want to selectively download only 1 file soap.xml by ftp. Is below code is correct way of doing it? Please see code + log 2. From log, I saw a lot of repeative things. Is it because of 5 min? What is the correct value? 5 to 60 mins? int min=5; int second=60; context.start(); Thread.sleep(min*second*1000); context.stop(); 3. How can we stop the process once the file soap.xml is downloaded? there is no need to wait for 5 mins. -- View this message in context: http://camel.465427.n5.nabble.com/Basic-from-fp-to-file-route-Need-clarification-1M-Thanks-tp4950632p4950632.html Sent from the Camel - Users mailing list archive at Nabble.com.