How to Connect components with Triggers or Rows

How to Connect components with Triggers or Rows
4.42 (88.33%) 12 votes

Working on Talend there is always question about which connection (link between two component) should I use?

In this post we are going to answer this question and also give more information about which connection will be executed first than other.

If you are a beginner then this post is very use full to start with Talend job development, and also shows you how to Connect component two components each other.

Advance user will know some facts about these connections.

As I stated earlier Talend has two flows first one is Row.

Row connections

This flow contains actual data, in the form of row which can be process to the next component using following connections.

  • Main
  • Iterate
  • Reject( Sometimes)

Main connection

Main flow allows you carry input data from input component to next component in the form of row.

If you want to process data from file and load to the database then this is the ideal connection type.

Talend process data row-by-row hence you can modify, convert, filter, or lookup your data using various components, like tMap see the image below.

Sample job with Main connection
Sample job with Main connection

This way you can pass your data to next component.

Priority: Always executes-First

Iterate Connection

This is another connection from row family it gives input rows in iterate on it.

It is very useful connection when there is need to process data row-by-row this is ideal connection.

Scenario: Want to process all the files from folder and load each file to db, then iterate connection will be used. You can use it as per your need see the image for more details.

iterate connection sample
iterate connection sample

Priority: Always executes-First along with Main

Reject connection

As the name depict it is used to get rejected rows from particular component, this connection is not supported by all the components.

It may exist on some components or you have to make it available

Note:  If you want Reject connection from DB components then unchecked basic=”die On error” and advance=”Use batch size” options.

See the below image where we are using all three connections.

Main, Reject, and Iterate connection sample job
Main, Reject, and Iterate connection sample job

we have seen Row flow and its Main, Iterate, and Reject flow connection now we will see Triggers.

Priority: It executes when there is a Reject rows along with main & iterate flow.


 Trigger

Triggers are used to transfer control from one component to another component.

Trigger is a action you want to perform based on previous action. There are following Triggers present but all of them will not be present for every component.

  • On Subjob Ok
  • On Subjob Error
  • Run If
  • On Component Ok
  • On Component Error.

As the name indicate, you can use each of the trigger to pass control or execute particulate subjob or component in Talend Job.

On Subjob OK

This is the frequently use trigger, it gives you confirmation whether previous subjob completed successfully or not. sub job can be set of component which links together using either Row connection or Triggers. 

Subjob can be a single component , like tJava, tJavaFlex or tRunJob which works without any input, output link.

Priority: It executed at the last- On completion of previous Subjob.

On Subjob Error

It is exactly works like on Subjob Ok except it gives you confirmation, when there is any error exception in job, component.

common use case is, to get error confirmation and send mail with details, or redirect flow to logging, or to die the job.

Priority: It executed when there is Error.

Run If Connection

This is very important feature, by using this you can control the execution based on certain conditions.

It is mostly used to execute particular flow instead executing all the flows one by one. Run If is similar to IF Else functionality in programming. 

You wan use multiple Run If from most of the component but if you want to use else if  then need additional details in condition because ultimately each Run If will be evaluated against given condition.

Priority: It executes after Main & Iterate link. based on predefined true condition.

On Component Ok

This works similar to On Subjob Ok except it acts on component not on entire subjob. you can use this trigger to execute certain subjob or component as soon as previous component gives confirmation that very thins is OK.

Priority: It executes after Main, Iterate & Run if . based on predefined true condition.

On Component Error

On Component Error works in same way except it gives confirmation about previous component error.

Priority: It executes when there is error. prior to on subjob error.

Below Image shows all the connections/Links in action.

All Talend Connection type sample
All Talend Connection type sample

 


 

We have seen important things about triggers and Row/Flow, In next post I will demonstrate which one has high priority and which has least priority.

Priority based execution will be demonstrated in next post. Subscribe to blog for notification.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

About dwetl

3 comments on “How to Connect components with Triggers or Rows

Leave a Reply

Your email address will not be published. Required fields are marked *