Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need to read file from FTP location as soon as it arrives  RSS feed

 
Rohit Mehta
Ranch Hand
Posts: 79
Chrome Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My application need to read file from ftp location, as soon as it is put on there. We are using Tomcat / Spring. I want to know my options..

A) Can I write some trigger/observer sort of which will call my program to read the file - as soon as it comes.
B) Or, I need to write some scheduler, which will keep checking the location on a regular interval, & read/process file in the next schedule check, after the file is placed.

Also for scheduling, which would be better choice - using Concurrent API - OR - some open source scheduler like Cron4j.

Thanks.
 
Rohan Dhapodkar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Camel here. By defining camel paths, in future you can easily change underline transport protocol from ftp to sftp or file. it will just a matter of few configuration changes and no code changes.

Check camel examples - http://camel.apache.org/ftp2.html

eg. from("ftps://admin@localhost:2222/public/camel?password=admin&ftpClient.trustStore.file=./src/test/resources/server.jks&ftpClient.trustStore.password=password").to("bean:foo");
 
H Paul
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just downloaded and played with it. So cool, CAMEL.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!