Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
DBS1
Contributor III
Contributor III

Handling error in tRESTClient component in talend

Hi Team

I am having a job which fetches the JSON stored in tFileInputExcel and patches the data using tRESTClient componet.
I am connectng the tFileInputExcel directly to tRESTClient and the Error link is connected to tDie to make the job fail.

If the error code is 401 (Access token expired), I don't want to make the job fail instead I need to regenerate Access token and need to post the same row as coming from tFileInputExcel.

How can this be done in Talend

Thanks in Advance.

Labels (3)
1 Solution

Accepted Solutions
DBS1
Contributor III
Contributor III
Author

Thanks for your suggestion.

I have implemented by the below approach.

tFileInputExcel -> tFlowtoIterate -> Iterate -> tFixedFlowInput -> tRESTClient.

From tRESTClient, I will catch the error code and if the error code is 401, the access token is regenerated and the same record is posted using another trestclient component. For error codes other than 401, I have connected the flow to tDie component to make the job fail.

Thanks

DBS

View solution in original post

4 Replies
Shicong_Hong
Employee
Employee

How do you regenerate the access token? is it coming from tFileInputExcel?

DBS1
Contributor III
Contributor III
Author

Thanks for your reply.

I am having a joblet which will generate the access token before reading from tFileInputExcel.

Once the access token is generated, we are patching the records stored in tFileInputExcel. If there are many records in Excel there is a chance that the job might get failed as a result of token expiration.

 

Thanks

DBS

Shicong_Hong
Employee
Employee

Thank you for your explanation. To re-run the job, you can use a tLoop  with 'while type'  to execute the job in a loop. Define a context variable with boolean type to determine whether the job continue to execute. This variable will be used in the Condition field on tLoop. In the end of job, reset the value of context variable based on the status of tRestClient.

 

 

DBS1
Contributor III
Contributor III
Author

Thanks for your suggestion.

I have implemented by the below approach.

tFileInputExcel -> tFlowtoIterate -> Iterate -> tFixedFlowInput -> tRESTClient.

From tRESTClient, I will catch the error code and if the error code is 401, the access token is regenerated and the same record is posted using another trestclient component. For error codes other than 401, I have connected the flow to tDie component to make the job fail.

Thanks

DBS