Six Stars

How not to stop an iteration if a component fails

Hey Guys,

i have a problem with a Job ive built. My Job iterates through a list of files, reads them and (normally) renames them. The Problem is, that there are two SOAP-Components in the Iteration. I hoped that i could build the job in a way that if SOAP isnt succesfull, the file gets the ending ".err". This part works, but after that the Job should take the next step in the list and just continue. What happens is that the whole job just stops. Is there a way I can avoid this? Best thing would be, that if you run the job once, for example there are 10 succesfull files and like 2 or so errors. At the moment it just stops on the first error it encounters and you have to start it manually again.

 

I hope i could explain my problem in a way someone understands it and can help me with it.

1 ACCEPTED SOLUTION

Accepted Solutions
Fifteen Stars

Re: How not to stop an iteration if a component fails

You can try it quite quickly. Remove the tFileList and create a context variable called "filename". Set the filename parameter of the tFileProperties component to context.filename and you are done. That is the child job sorted. Now create another job (the parent job) and add a tFileList (configured as before) and connect a tRunJob to it. Set the tRunJob Job to be the original Job. In the Context Param section add the filename context variable. Set it to the value returned by the tFileList (what you currently have in the tFileProperties) and untick "Die on Error". Done.

Rilhia Solutions
9 REPLIES
Fifteen Stars

Re: How not to stop an iteration if a component fails

There will be ways of achieving this, but it is difficult to help without a screenshot of your job. Can you post one please?

Rilhia Solutions
Six Stars

Re: How not to stop an iteration if a component fails

 
Fifteen Stars

Re: How not to stop an iteration if a component fails

OK, the reason this does not continue is that if the component errors, the flow is diverted using the OnComponentError link and is not merged back to the main flow at all. I have a question whether this would work anyway as immediately after your first tSOAP you use a tExtractXMLField to (I assume) consume the SOAP response. The next tSOAP I can only assume is using something from that response to pass to the SOAP service. Does the second tSOAP rely on data from the first? If so, your iteration should not complete for that file. If not, you can separate the flow into two flows to be run one after the other.....maybe using a tFlowToIterate before the second tSOAP and then using a tFixedFlowInput connected to the second tSOAP AND the first error (by a RunIf link or similar).

Rilhia Solutions
Six Stars

Re: How not to stop an iteration if a component fails

okay first, thanks for your reply, but i think you mean something different. My Problem is that for example there are 100 files. For each File the complete Job should be done. Lets say the 5th file has a problem and the SOAP request doesnt work. I hoped that it would just go to the tWarn part (which is basically just renaming the file) and than it could start with the 6th file from the beginning. What really happens is that it completely stops. So if just one SOAP request failes, you need to restart the whole job manually. I already tried to restart the Job with a tRunJob Component but apperently you cannot use it to start the exact same job again.

So i dont need to bypass the SOAP components, but the job should just go on with the file list.

 

I hope this explained it better Smiley Wink

Fifteen Stars

Re: How not to stop an iteration if a component fails

Oh I see now. Your tSOAP component is erroring and it does not have a "Die on Error" option....it will always cause the Job to die on error. There is a difference between a SOAP service not getting a useful response and erroring. Is there a way to ensure that it doesn't error? If not, can I suggest you use the tESBConsumer component? It won't be too different to the tSOAP but will give you the option to untick the "Die on Error" which will mean it will allow the processing of subsequent files to continue. Alternatively , you can get round this by carrying on using the tSOAP but putting everything after the "iterate" into another Talend job. Then using the tRunJob to call that job on the iteration. You would need to pass in the filename to a context variable within the new job and use that to point to the file. This way is probably the easiest way for you to continue with this. You will need to make sure you untick the "Die on Error" in the tRunJob config.

Rilhia Solutions
Six Stars

Re: How not to stop an iteration if a component fails

okay thank you!

these are some usefull ideas. Since the part with SOAP and XMLextraction has been written by a colleague of mine, i will talk with him and hopefully we can find a solution based on your ideas. Thanks!

Fifteen Stars

Re: How not to stop an iteration if a component fails

You can try it quite quickly. Remove the tFileList and create a context variable called "filename". Set the filename parameter of the tFileProperties component to context.filename and you are done. That is the child job sorted. Now create another job (the parent job) and add a tFileList (configured as before) and connect a tRunJob to it. Set the tRunJob Job to be the original Job. In the Context Param section add the filename context variable. Set it to the value returned by the tFileList (what you currently have in the tFileProperties) and untick "Die on Error". Done.

Rilhia Solutions
Six Stars

Re: How not to stop an iteration if a component fails

You were right Smiley Happy I was a bit fast with assuming it would be a lot to do! Now it works really good, Thank you again!

Fifteen Stars

Re: How not to stop an iteration if a component fails

No problem :-)

Rilhia Solutions