camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BAnanth <bhavani.ana...@wipro.com>
Subject Camel-FTP - retrieving the files tranferred and updating DB
Date Thu, 31 Oct 2013 10:15:23 GMT
Hi,

I have  the following requirement  

a. I have to transfer a file between two FTP servers. The URI's are
dynamically created.  (This has been done)
b. Upon the successful transfer, I need to update the database with all the
files that have been succesfully transferred.
b.1 The DB table has the following structure id,filename,
fromLocation,transferStatus,toLocation,timestamp
c. Upon Exception the same has to be captured in the database.
(transferStatus column to be updated)

The snippet of the 'configure' method of the 'RouteBuilder' class is
displayed below. (from, to etc are the parameters passed and refer to the
FTP from URI and to URI respectively)

/public void configure() throws Exception {
                String successQry =
FTPDAOHelper.createQueryToInsertRecordInFileHistory("hardcodedfileName-how
to get", from, FTPConstants.FTP_SUCCESSFUL, to, channelId);
               String failedQry =
FTPDAOHelper.createQueryToInsertRecordInFileHistory("hardcodedfileName-how
to get", from, FTPConstants.FTP_FAILED, to, channelId);
			   onCompletion().onCompleteOnly().log("Fully
Complete").setBody().constant(successQry).to("jdbc:dataSource");
			  
onCompletion().onFailureOnly().log("Failed").setBody().constant(failedQry).to("jdbc:dataSource");
              
from(from).to(to).setBody().constant(successQry).to("jdbc:dataSource");
}/

I am facing the following problems,
a. The success qry and failure qry are always fixed. Even though I am
generating a unique UUID for file history table,the query generated uopon
the execution always inserts the same record again and again.
b. What could be the alternate approach (other than onComplete()). 
c. How do I get the file names and other parameters of the file from the
exchange?

Thanks and Regards,
Bhavani




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-FTP-retrieving-the-files-tranferred-and-updating-DB-tp5742443.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message