Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
DBS1
Contributor III
Contributor III

Check the response code from tFileFetch component

Hi Team

I am posting a JSON file to API URI using tfileFetch component.

I have a requirement to capture the response code from tfilefetch and if the response code is in series of 500, I need to loop back to tfilefetch to post the JSON file again. This needs to be continued until the response code is not in 500 series.

Could anyone please help how this can be implemented in talend.

Thanks

Dhanoop

Labels (4)
4 Replies
Anonymous
Not applicable

Hi

Can you share a screenshot to show us the response code? Is it printed on the console? If so, you need to redirect all the messages printed on the console to somewhere, read the messages and extract the response code and parse it.

 

Regards

Shong

 

DBS1
Contributor III
Contributor III
Author

@Shicong Hong​ 

 

The response code is printed on the console. Please find the screenshot as well.

 

0695b00000skWNeAAM.png 

Please let me know how we can extract the response code.

 

Thanks

 

DBS1
Contributor III
Contributor III
Author

@Shicong Hong​ Any solution for the above

Anonymous
Not applicable

@Dhanoop B S​ , read this post to learn how to redirect the output from console to a file, then read the content of entire file as a string using tFileInputRaw component, check the string if it contains "500" or extract the response code using regex expression on a tJavaRow. Create a context variable (Boolean type), used to determine whether to rerun tfilefetch component.

​To redirect the log messages from console to a file, you can also use tRedirectOutput component, this is a custom component shared by brazabr, download it from here.

 

Regards

Shong