Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
How do you regenerate the access token? is it coming from tFileInputExcel?
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
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.
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