Reputation: 297
I have a Talend job where i am making a ftp connection and downloading a file. I wanted to add capability where if the ftphost is not responding i can retry connecting n times before killing the job. I looked at lLogCatcher and tLoop but that doesn't seem to serve the purpose. Any pointers on which direction i should take would be appreciated.
Upvotes: 2
Views: 2596
Reputation: 3973
To catch Exception, you can use a tJavaFlex containing a try and catch, then by playing with conditions you can use tLoop, I have developed this small job because i love challenging, and its works fine
We need 2 context variable:
tLoop settings, use while type:
tJava_1: its just to generate different ip so i can perform the test, you can remove it for your case.
tJavaFlex: to catch Exception, write try{
in start code box and }catch(Exception e){System.out.println("to the next try ");}
in the end code box. You MUST use iterate to connect the next component.
tFTPConnection: your FTP settings.
tJava_2: if tFTPConnection is ok, we need to make tLoop break looping by altering the context variable, write this line:
context.isitok=1;
tJava_3: just to ensure orchestration, it have no code.
If (order:1) : ((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")) < context.trynb
If (order:2) : ((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")) >= context.trynb
Upvotes: 4