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}}&filter=#processFilter&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}}&filter=#processFilter&consumer.delay={{ftp.delay}}&delete=true"/>
<to
uri="sftp://{{ftp.username}}@{{ftp.host}}{{ftp.host.processedPage}}?password={{ftp.password}}&filter=#processFilter&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.