Talend 'OnSubjob' and 'OnComponent'

Sometimes it could be a bit confusing to a Talend developer what the differences are between the On SubJob and the On Component links. OK versus ERROR is obvious. 

 

The purpose of this blog is to understand the differences between On SubJob and On Component, and their respective Trigger Connections like OK versus ERROR, and how do they affect a job design flow?

 

On SubJob and On Component are called as connectors that connect between subJobs or components respectively. Trigger Connections between components define the processing sequence and data flow where dependencies between components exist within a subJob. SubJobs are characterized by a component having one or more components linked to it dealing with the current data flow. Multiple subJobs can exist within a single Job, which is visualized by default in the design window as having a highlighted box around all the related subJob components.

 

Trigger connection: OnSubJob

onSubJob.png

 

onSubJobOk.png

 

Trigger connection: OnComponentOK

onComponentOK.png

 

onComponentOK2.png

 

Similarly, an On Subjob OK/ERROR trigger will continue the process to the next ‘linked’ subJob after all components within the subJob have completed processing. This should be used only from the starting component in the subJob.

onSubJobError.png

 

An On Component OK/ERROR trigger will continue the process to the next ‘linked’ component after that particular component has completed processing.

onComponentError.png

 

What is the difference?

OnComponent OnSubJob
Belongs to Component Triggers Belongs to SubJob Triggers
The linked subJob starts executing only when the previous component successfully finishes its execution. The linked subJob starts executing only when the previous subJob completely finishes its execution.
This link can be used with any component in a Job. This link can only be used with the first component of the subJob.

 

Illustration

The following diagram shows a Job with three subJobs:

example.png

 

The main difference between OnSubjobOK and OnComponentOK lies in the execution order of the linked subJob. With OnSubjobOK, the linked subJob starts only when the previous subJob completely finishes. With OnComponentOK, the linked subJob starts when the previous component finishes.

 

The execution order of subJobs linked by OnComponentOK is within the execution cycle of the previous subJob. In this example, subJob 2 starts when tLogRow_1 finishes; subJob 3 starts when both subJob 1 and subJob 2 end, because subJob 2 runs within the execution cycle of subJob 1.

 

Limitation

OnComponent: OnComponent trigger connection does not verify the successful/unsuccessful execution of any custom code/routine called from respective components.

OnSubjob: Only connects between start/first component of two subJobs. So if flow of one subJob is long, then your OnSubjob connection link is also long.

 

Conclusion

  • OnSubjobOK will be used to continue the Job flow from one subJob to another when the first subJob execution is OK without any Error. And OnSubjobError will be used to continue from one subJob to another when the first subJob is having some Error.

  • OnComponentOK will be used to continue the Job flow from one component to another when the first component execution is OK without any Error. OnComponentError will be used to continue from one component to another when the first component is having some Error.

  • With OnSubjobOK, the linked subJob starts only when the previous subJob completely finishes.

  • With OnComponentOK, the linked subJob starts when the previous component finishes.

The execution order of subJobs linked by OnComponentOK is within the execution cycle of the previous subJob.

Version history
Revision #:
3 of 3
Last update:
‎03-20-2020 05:53 PM
Updated by:
 
Labels (1)