Hi

Just use the move option on the ftp endpoint (ftp inherits the options
from the file)
http://camel.apache.org/file2

from ftp?move=success
   process file

There is also a moveFailed if you want to move files that failed to
some other place.



On Tue, May 3, 2011 at 2:57 PM, kanmisc <[email protected]> wrote:
> Hi All
>
> I have a usecase where I need to download a file from ftp server, process
> it; if the processing of all the records from the file is success I need to
> move the file to different location in the same ftp server.
>
> Issue is - regardless of the route request coming from java class(2), ftp
> route(3) executes and moves the file. How to control these routes,
> particularly ftp/sftp routes? Also noticed,  when the route(1) is executing
> and processing the file in java, route(3) also simultaneously starts polling
> the ftp server.
>
> My routes are given below-
>
> 1) <route id="sftp">
>        <from
> uri="sftp://{{ftp.username}}@{{ftp.host}}{{ftp.host.landingpage}}?password={{ftp.password}}&amp;filter=#processFilter&amp;consumer.delay={{ftp.delay}}";
> />
>        <bean ref="processTheFile" method="process"/>
>        <stop/>
> </route>
>
> 2) After processing the file in java class i have logic as below to route to
> another endpoint -
>
> @EndpointInject(uri = "direct:move.ftp.done")
> ProducerTemplate ftpMoveTemplate;
> ....
> ...
> if(totalRecords == processedCount) {
>        logger.debug("Records processing done, moving the file");
>        ftpMoveTemplate.sendBody("success");
> }
> else {
>        logger.debug("Records processing failed, not moving the file");
> }
>
> 3) This route moves the file -
> <route>
>        <from uri="direct:move.ftp.done"/>
>        <choice>
>        <when>
>                <simple>${body} contains 'success'</simple>
>                <to uri="direct:moveFtpFile"/>
>        </when>
>        </choice>
> </route>
>
> <route>
>        <from uri="direct:moveFtpFile"/>
>        <from
> uri="sftp://{{ftp.username}}@{{ftp.host}}{{ftp.host.landingPage}}?password={{ftp.password}}&amp;filter=#processFilter&amp;consumer.delay={{ftp.delay}}&amp;delete=true"/>
>        <to
> uri="sftp://{{ftp.username}}@{{ftp.host}}{{ftp.host.processedPage}}?password={{ftp.password}}&amp;filter=#processFilter&amp;consumer.delay={{ftp.delay}}"/>
>        <stop/>
> </route>
>
>
> Any help on this appreciated.
>
> Thanks
> Kannan
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Issue-in-multiple-sftp-routes-tp4367176p4367176.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to