Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
stagliaferri1640766615
Contributor II
Contributor II

How to implement API call retry

Hello community,

I need your help 🙂

I created a flow which is calling API using tREST component (See flow.jpg).

I am looping till I don't get any result from the page (to end the loop) (see tJav

.jpg

a loop.jpg)

The API often timeout so I would like to implement a retry option.

Any hints how I could do it ?

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

yes, if you need to pass value from main job to child job, you need to define context variable in child job, and select the variable on tRunJob to receive the value. Let me know if you have any more questions.

 

 

View solution in original post

5 Replies
Anonymous
Not applicable

Hi

When timeout occurs and the job fails to run, to retry the API call, move this part to a child job, use a trunJob to call the child job and uncheck the 'die on error' option.

0695b00000Wx7o4AAB.pngDefine a global variable that both of main job and child job can access it, this variable is used on tLoop as you did now. In the child job, set the value of global variable to true when an error occurs.

 

Regards

Shong

 

stagliaferri1640766615
Contributor II
Contributor II
Author

Thank you Shong.

I think I am doing something wrong - could you please tell me how to create a child job and use tRun to call it?

Anonymous
Not applicable

Create a new job, then copy the components I mentioned and paste them to the job. In the original job, use a tRunJob component to call the new job.

If you need to pass some value from main job to child job, please refer to this article.

 

stagliaferri1640766615
Contributor II
Contributor II
Author

Thank you again! though I have more questions, sorry 😞

in the main job I have to pass two values: id and loop which are not context variables.

In the Tjava in the main job I print out:

 

globalMap.get("id"));

globalMap.get("tLoop_2_CURRENT_ITERATION");

 

looking at the article it seems that I have to define :

 

id

tLoop_2_CURRENT_ITERATION

 

in the context as , for example: context.id

 

is that correct?

Anonymous
Not applicable

yes, if you need to pass value from main job to child job, you need to define context variable in child job, and select the variable on tRunJob to receive the value. Let me know if you have any more questions.