Loop a subjob n times if exit code is not 0

Five Stars

Loop a subjob n times if exit code is not 0

I am trying to execute a code in tsystem and then depending on exit code i am taking relevent steps.

Now if the exit code is not 0 i want to retry executing it 5 times and even after 5 times if the error code is not 0 i  don't want to execute any more and move to other part of job.

 

How can i achieve this. Any help appreciated.

Tags (1)
Fifteen Stars TRF
Fifteen Stars

Re: Loop a subjob n times if exit code is not 0

Hi,

Using a tJava component in the loop, you may count the number of retry and store the result in a global variable (let's say "your_retry_count").

Now you can have a tLoop (type While) with the following condition:

((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE")) != 0 && ((Integer)globalMap.get("your_retry_count")) < 5

Should works.

 


TRF

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch