Skip to main content

Error Handling Mechanism in Talend Open Studio

Error Handling Mechanism in Talend Open Studio

Three Error Handling Strategies in Talend Open Studio

You can recover from some errors.  Others, like system or network failures are fatal.  But even in the fatal case, your Talend Open Studio job should die gracefully, notifying the operations team and leaving the data in a good state.  This post presents three error handling strategies for your Talend jobs.

Some Talend Open Studio job errors are alternate paths that, though infrequent, occur often enough to justify special programming. This programming may come in the form of guard conditions, special logic applied to route the special case to another sub job.  For an example of these type of errors, see this blog post on ETL Filter Patterns.

Other errors are related to system and network activity or are bugs.  There are a few ways to handle this class of error in Talend Open Studio.

Do Nothing

For simple jobs, say an automated administrative task, you can rely on the exception throwing of Talend Open Studio.  An example is a simple input to output job where a database failure in writing the output results in a system error.  This is expressed in the Run View as a red stack trace.

Simple Job with No Extra Error Handling Configured 
Sub job or Component Error Triggers

Each subjob and component has a return code that can drive additional processing.  The Subjob Ok/Error and Component Ok/Error can be used to steer the error toward an error handling routine like the tSendMail component.  This example looks for a connection error (the database is off) or a file processing error (the database is on, but the table name is wrong).

Both an individual subjob and a finer-grain component can be tested.  The screenshot shows two tSendMail routines being called from an OnSubjobError trigger.

Error Handling Tailored to the Subjob (or Component)
While testing the individual subjobs and components has the advantage of providing error handling tied to the specific case, there are disadvantages in maintenance and testing.  Maintenance suffers because the job  becomes cluttered with extra components which can confuse the normal processing, less frequent processing, and the error handling.  Testing is harder because there are more test cases.

Sometimes, there is a need for this level of detail.  You may want to send a file that represents an intermediate stage of processing via email.  This file isn't available throughout the job, and not every failure can handle this.

tAssertCatcher

A more general strategy is to define an error handling subjob to be performed when an error -- any error -- occurs.  This has the important advantage of consolidating the error handling, dramatically reducing testing.  It puts the burden of testing for error conditions on Talend (where it belongs).

To implement the general strategy, use the tAssertCatcher component which will be invoked whenever any component throws an error.

A Shared Error Handler with tAssertCatcher

If there's a failure in the XSL component (tXSLT) or other component resulting in a Java exception, the job will continue with the error handler (in this case a tLogRow) attached to the tAssertCatcher. tAssertCatcher can route an error message to other handlers like a tSendmail.

tAssertCatcher Config
Components like tXSLT don't need any additional configuration to use tAssertCatcher.  The tFileInputXML has a "Die on error" checkbox that needs to be set.

In the following screenshot, the database component tMSSqlOutput_1 has "Die on error" set.  If the flag is not set, then the tMSSqlOutput will print a message and the tAssertCatcher will not be called.  This particular example caught errors from the connection component (bad login) and the tMSSqlOutput component (DB-generated unique constraint violation and invalid insert of identity column).

An Example with Database Components


Let Talend Work

Handling system errors is different than alternate paths and conditions that arise during coding a Talend job.  Sometimes, you'll have a specific error routine for a specific system error condition.  But where possible, let Talend throw the system errors and catch them with a tAssertCatcher.

Comments

  1. hi sir
    PICTURES are not visible in your faq answers can you update if possible

    ReplyDelete
  2. Article, its very informative content..thanks for sharing...Waiting for the next update…
    manual testing tools
    tools for manual testing

    ReplyDelete
  3. Great blog. Thanks for sharing such a useful information. Share more.
    Pytest Online Course
    Pytest Online Training

    ReplyDelete

Post a Comment

Popular posts from this blog

TALEND Interview questions and Answers

TALEND Interview questions and Answers (http://www.deepinopensource.com/talend-interview-questions/) 1.    Talend – Merge multiple files into single file with sorting operation. 2.    Loading Fact Table Using Talend 3.    ROWNUM Analytical Function in Talend 4.    SCD-2 Implementations in Talend 5.    Deployment strategies in Talend 6.    Custom Header Footer in Talend 7.    Data Masking Using Talend 8.    How to use Shared DB Connection in Talend 9.    Load all rows from source to target except last 5 10.    Late Arriving Dimension Using Talend 11.    Date Dimension Using Talend 12.    Dynamic Column Ordering Of Source File Using Talend 13.    Incremental Load Using Talend 14.    Getting Files From FTP Server 15.    Initializing Context At Run Time Using Po...

Talend Interview Questions

You came across here that means it is worth of writing this post. 🙂 Whenever I go for the interview there will be some new questions, so I thought why not to draft all these questions at single place? It is just attempt to remember all Talend Interview question nothing else. Difference between tMap and tJoin component in Talend . Difference between tAggregaterow and tAggregatesortedrow. Difference between tJava,tJavarow,tJavaflex. How to improve the performance of Talend job having complex design? Difference between built in schema and Repository. What is the declaration of method which we define in system routine? What is XMS and XMX parameter in Talend? How to resolve heap space issue in Talend ? How to do the exception handling in Talend? What is Default join for tMap. What are the different lookup patterns available with Talend? What is the basic requirement while updating the perticular table? How to generate surrogate key by using Talend? What is the use of E...