One Star

Trying to build retry logic for FTP Upload..

Hi,
I'm trying to build a job(let) that performs an FTPPut of a designated file to a server with retry logic added.
The joblet needs to be able to re-try the connection/upload a set number of time before giving up and failing.
I'm using TIS 4.1.2(r53616).
What we have tried so far is to use a tLoop to iterate and tRunJob that does the FTP. When we 'simulate' a failed connection (using wrong password) the FTP fails with an exception, however the tRunJob does not trigger the 'error' link..
Any advice on this?
4 REPLIES
One Star

Re: Trying to build retry logic for FTP Upload..

Hi
The expression of If2(error link) is as follow.
((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"))==1

Regards,
Pedro
One Star

Re: Trying to build retry logic for FTP Upload..

I made the change and get the following result..
Starting job Jb_Retry_FTP_sample_job at 11:59 06/02/2012.
connecting to socket on port 3970
connected
Count:1
Statys:Starting
tRunJob_1 in Jb_Retry_FTP_sample_job call JB_FTP_Test with:

Child job return 1. It doesn't terminate normally.
Exception in component tFTPPut_1
com.enterprisedt.net.ftp.ControlChannelIOException: Connection reset
at com.enterprisedt.net.ftp.FTPControlSocket.readLine(FTPControlSocket.java:1014)
at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:1049)
at com.enterprisedt.net.ftp.FTPControlSocket.validateConnection(FTPControlSocket.java:418)
at com.enterprisedt.net.ftp.FTPControlSocket.<init>(FTPControlSocket.java:384)
at com.enterprisedt.net.ftp.FTPControlSocket.<init>(FTPControlSocket.java:355)
at com.enterprisedt.net.ftp.FTPClient.connect(FTPClient.java:958)
at pj_na_dis_chanadvus.jb_ftp_test_0_1.JB_FTP_Test.tFTPPut_1Process(JB_FTP_Test.java:235)
at pj_na_dis_chanadvus.jb_ftp_test_0_1.JB_FTP_Test.runJobInTOS(JB_FTP_Test.java:643)
at pj_na_dis_chanadvus.jb_ftp_test_0_1.JB_FTP_Test.main(JB_FTP_Test.java:514)
Exception in component tRunJob_1
java.lang.NullPointerException
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.tRunJob_1Process(Jb_Retry_FTP_sample_job.java:913)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.tJava_3Process(Jb_Retry_FTP_sample_job.java:724)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.tLoop_1Process(Jb_Retry_FTP_sample_job.java:612)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.tSetGlobalVar_1Process(Jb_Retry_FTP_sample_job.java:469)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.runJobInTOS(Jb_Retry_FTP_sample_job.java:1480)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.main(Jb_Retry_FTP_sample_job.java:1313)
disconnected
Job Jb_Retry_FTP_sample_job ended at 11:59 06/02/2012.

The job does not loop..
Steven
One Star

Re: Trying to build retry logic for FTP Upload..

Can you change your IFs to onSubjobOK and onSubjobError?
One Star

Re: Trying to build retry logic for FTP Upload..

Change the ifs to OnSubJobOK and OnSubJobError, allows the loop to iterates and clams it a success but the FTP fails.
Checking ports...
Sending job 'Jb_Retry_FTP_sample_job' to server (secdevbietl09.us.gspt.net:8001)...
File transfer completed.
Deploying job 'Jb_Retry_FTP_sample_job' on server (10.157.202.42:8000)...
Running job 'Jb_Retry_FTP_sample_job'...
Starting job Jb_Retry_FTP_sample_job at 14:53 08/02/2012.
connecting to socket on port 3574
connected
Count:1
Statys:Starting
tRunJob_1 in Jb_Retry_FTP_sample_job call pj_na_dis_chanadvus.jb_ftp_test_0_1.JB_FTP_Test with:

Count:2
Statys:success
Count:3
Statys:success
Count:4
Statys:success
Count:5
Statys:success
Loop Finish
disconnected
Exception in component tFTPPut_1
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.enterprisedt.util.proxy.PlainSocket.createPlainSocket(PlainSocket.java:102)
at com.enterprisedt.net.ftp.FTPControlSocket.<init>(FTPControlSocket.java:355)
at com.enterprisedt.net.ftp.FTPClient.connect(FTPClient.java:958)
at pj_na_dis_chanadvus.jb_ftp_test_0_1.JB_FTP_Test.tFTPPut_1Process(JB_FTP_Test.java:235)
at pj_na_dis_chanadvus.jb_ftp_test_0_1.JB_FTP_Test.runJobInTOS(JB_FTP_Test.java:643)
at pj_na_dis_chanadvus.jb_ftp_test_0_1.JB_FTP_Test.runJob(JB_FTP_Test.java:521)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.tRunJob_1Process(Jb_Retry_FTP_sample_job.java:836)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.tJava_3Process(Jb_Retry_FTP_sample_job.java:731)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.tLoop_1Process(Jb_Retry_FTP_sample_job.java:619)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.tSetGlobalVar_1Process(Jb_Retry_FTP_sample_job.java:476)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.runJobInTOS(Jb_Retry_FTP_sample_job.java:1425)
at pj_na_dis_chanadvus.jb_retry_ftp_sample_job_0_1.Jb_Retry_FTP_sample_job.main(Jb_Retry_FTP_sample_job.java:1258)
Job Jb_Retry_FTP_sample_job ended at 14:53 08/02/2012.