A new problem and a new solution. I wanted to solve the question of Error recovery implementation from Talend Open Studio (Jaspersoft ETL). Found a Component tCheckpoint created by “Talend By Example” and then spent some time to figure out how to use it. Now I am sharng my knowledge to you guys so that its easier for you to understand and implement.
We wanted to find the way to answer following questions
How to Record the point of failure?
How to Resume from the point of failure – don’t re-run successfully executed code?
How to Execute custom recovery code?
How to allow normal execution of previously unexecuted code?
1) First, download the tCheckpoint.zip file from below link.
2) This contains 3 components.
3) Add these components into Talend Palette as follows
a) Open Talend Open Studio
b) Go To Window >> Preferences >> Talend >> Component
c) Under User Component folder , select the folder where you have extracted the tCheckpoint.zip file.
d) Now you will have all the 3 Components available in the Palette.
4) Drag tCheckpointStart Component. Here there are two Basic Settings available.
a) Checkpoint Directory : Where you want your Checkpoint File to be saved.
b) Checkpoint File : Actual File Name. If you leave it empty, the component would create a file name as
5) Now Drag tCheckpoint Componet. Update the code as below
if((Boolean) globalMap.get("tCheckpoint_1_NEEDS_RECOVERY")) System.out.println("Checkpoint 1 needs recovery");
if((Boolean) globalMap.get("tCheckpoint_1_NEEDS_EXECUTION")) System.out.println("Checkpoint 1 needs execution");
6) Right Click on the Component and select RunIf and connect it to the Job you want to run for execution.
7) Now select the “If” link and update the condition as follows.
8) Similarly add multiple tCheckpoint Component for number of subjobs you have and just change the Number in the codes.
9) In the end use tCheckpointEnd component.
10) Note that all the tCheckpoint Components will be connected by the condition “OnSubjobOK”.
Find the job which I have created below
When the job is run, the jobs which are successful in first run would have boolean value True and the value would stop at the failed job. When you rerun the job the Boolean value for already run job would become False and the job will start running from the failed job.