Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to check if the file exists on ftp server I am using tftpfileExist.
If the file is not found after certain period of time it should send a notification and loop again to check if the file is present. (Check every 1 minute). Once the file is found the job should kick and on completion it should send a notification and loop back to check for the next file.
current design below works fine
tftpconnection---onsubjob--> tFTPFileexist---onsubjob-->tFTPGet1---onsubjob-->TFileExist---onsubjob----Process---notification email ...
|flase
email notification
I am struggling which component to use tloop or tinfiniteloop and tsleep after which component and what variables i need to include. Can this be achived in one job? Would be helpful is some one could provide an example.
I have modified the design and able to pass the values from child to parent job. The process does not exit even if the file has been processed. I want the process to exit and check again for the file next day. Any suggestion. I have attached the updated design.
Remind me, what version are you using? I cannot see enough from the screenshots. Export your job and attach it and I will have a look at it. That might be easier.
Right, I think I have it. I cannot test this here so I have taken a screenshot of the parent job. I reckon this can be sorted with just a few changes there. Here is the new Parent Job....
I've added a new tJava component, modified the tLoop expression and edited the tJavaRow code. Everything else remains the same.
tJava Code
globalMap.put("check", true);
tLoop Config
tJavaRow Code
//Code generated according to input schema and output schema
System.out.println("The File Message:"+input_row.FILENAME);
globalMap.put("check", false);
if(input_row.FILENAME){
globalMap.put("check", true);
}
What this does is make use of the boolean you are sending back from the Child Job (in a field called FILENAME??). After every iteration, the "check" globalMap variable is set to false. This will stop the tLoop. However, if the child job returns a value that is true (you are converting a false to a true in your child job), then it sets the "check" value back to true. This will keep the tLoop going.
The Child Job does not necessarily have the logic that I would have chosen, but I have given you code that only affects the Parent Job to make it as easy as possible to fix this. You may want to (once you see how this works) refactor your Child Job to make the whole process a bit more logical with regard to the messages sent back from the child job. Maybe you could send a true or a false based on the success or failure of the find file?