Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
@Shicong Hong
The response code is printed on the console. Please find the screenshot as well.
Please let me know how we can extract the response code.
Thanks
@Shicong Hong Any solution for the above
@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