Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Difference between OnSubJobOk and OnComponentOk

What is the difference?
Labels (2)
4 Replies
Anonymous
Not applicable

Hi
OnSubJobOk and OnComponentOk are the same apparently.
But in java source code, they are defined with different logic.
Here is an example.
You need to regard tRowGenerater--OnComponentOk-->tJavaFlex as a subjob.
In the end, you will find the 'OnComponentOk' tJava_2 will execute while the 'OnSubjobOk' tJava_1 won't.
Best regards!
Pedro
Anonymous
Not applicable

Jack Black,
OnComponentOk: This link will be executed when 1 Component has succesfully executed.
OnSubjobOk: This link will be executed when a whole "SubJob" has been executed. This can be multiple components in a flow. In a job you can have different subjobs, you can see what's a subjob when there is a background. The components will be in a sort of box.
For example:
You want to read a file into a database and when the file has been inserted in the database you want to sent a mail.
tFileDelimitedInput --> tMap --> TMssqlOutput
|
|OnSubJobOk
|
tSendMail
What this will do is execute the subjob first which are the three component at the top to read the file and insert in the database. Once that's done the Subjob will be completed and it will execute the tSendMail component.

When you only have one component a OnComponentOk and OnSubJobOk link will do the same. Because one component is considered a subjob when it's not linked to any other components.

Regards
Anonymous
Not applicable


The main difference between OnSubjobOK and OnComponentOK is 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.
MattE
Creator II
Creator II

It's worth noting that OnComponentOk can fire even when you aren't expecting it to.

 

In the example below i call a rest API, get a successful response and write the string "Success" to the file. Even though the subjob didn't go down the failure route the final subjob is still triggered by OnComponentOk and overwrites the text "Failure" to the file.

 

This has caught a member of my team out recently.

 

0695b00000debDnAAI.png