Talend Open Studio (TOS) components like tMSSqlOutput allow you to specify whether an error is fatal -- causing processing to abort right away -- or non-fatal, allowing processing to continue. This behavior is specified by the "Die on error" option.
Allow Non-Fatal Errors in a tMSSqlOutput |
Processing Stops During the First Iteration |
tForeach with List of Three Values |
Configuration of tSSH - Use Input as Target Host |
Code Generation
When TOS generates Java classes that use an iteration connection, exceptions in components like tSSH break out of the iteration. What we can do is work with the code generation to wrap a few Java keywords around the statements formed by tSSH. This is done with a tJavaFlex.
Job Supporting Continuing |
The Start and End Blocks Open a try / catch Block |
The result is a job that will continue processing over the entire input set. This screenshot shows three tSSH attempts on the three input IP addresses. All fail, but processing can continue.
Job That Performs tSSH on All Input (Continuing) |
If you use this in your jobs, you may find that it is incompatible one day.
It's a bad practice to code TOS jobs that rely on the operation of the code generator. However, this is a solution that will work across multiple versions of TOS including the latest (5.1.0) and it is a clean way to work with tSSH or any other deficient (no "Die on error") components.
tJavaFlex prepares start and end blocks that frame the main part of a tJavaFlex as well as downstream components. This example allows a tSSH to continue processing in the event of an error.
Thank you for this tip!
ReplyDeletei used this with tFileUnarchive when trying to decompress a corrupted file to avoid an exception and end the job.
Thanks for the help. I had a user defined SQL function failing in an iteration.
ReplyDeleteYep, helped me with tFileUnarchive as well. Talend definitely needs an improved and consistent way to handle errors.
ReplyDeleteHi Paul, would you mind sharing what you did with iFileUnarchive exactly? I have the same issue and must continue when decompressing a corrupt file. Thanks!
DeleteI have implemented it with tFileUnarchive and it works fine. Why in the hell does the tFileUnarchive have an "on component error" option if it is unable to manege errors???
ReplyDeleteThanks for this - I used the information to get a list of worksheets in an Excel spreadsheet by looping over a spreadsheet using the loop's current value as the sheet position, breaking when the "no sheet found" error occurred.
ReplyDelete