One Star

Passing a data flow into a tRunJob component

Can someone explain how to pass a data flow into a tRunJob component? The examples in the documentation show only how to do so with using an Iterate connector or an OnSubJobOk connector. I need to use a "Main" data flow connector to call a second job an pass the data flow in that way.
What I'm trying to accomplish is very similar to what you do when you execute a JobLet. Joblets allow you to pass a data flow (i.e. Row > Main) into the Joblet, and then that data flow becomes the starting input for the Joblet. Is there similar functionality available for "Jobs" too? It seems like this functionality should be there because Talend allows you to execute a Job via a Row > Main connector; however, I cannot see how to reference that data in the child job. (The tRunJob component even has a schema which suggests that this should be possible).
So - here's what I'd like to do as an example:
Job 1:
1. tRowGenerator generates a list of 10 FirstNames.
2. Row > Main Connector is used to execute Job 2 via a call to tRunJob (passing in the same schema as the tRowGenerator).
Job 2:
1. Takes the data flow input passed in from Job 1 and outputs it to the console window via tLogRow component.
The problem I'm having is in figuring out how to reference the data passed in to Job 2, so I can pass it into the tLogRow component.
Has anyone been able to accomplish this?
Thanks.
3 REPLIES

Re: Passing a data flow into a tRunJob component

check out the tBufferInput and tBufferOutput components to pass data between subjobs.
One Star

Re: Passing a data flow into a tRunJob component

Hi JohnGarrettMartin,
Thanks for the response. I spent a fair amount of time this morning going over the functionality of the tBufferOutput and tBufferInput functionality, and I believe it is not quite what I'm looking for because of the following reason:
These two components can be used to pass data from a Child job to a Parent job, but not the other way around. tBufferInput must be used in conjunction with tBufferOutput WITHIN THE SAME JOB. I got most of this information from this post here: http://talendforge.org/forum/viewtopic.php?pid=29576
Shong's recommendation was to pass the data flow from the child job to the parent, and this is the same as all the examples in the documentation. (There are examples of passing 1 row at a time to a child job via context variables, but that's not what I'm looking for. I'm looking to pass the entire flow without using an "iterate" connector).
Do you agree with my assessment?
Thanks.
Community Manager

Re: Passing a data flow into a tRunJob component

Hi
I'm looking to pass the entire flow without using an "iterate" connector).

You have to put your child job in a joblet so as to pass the entire flow to joblet, otherwise, you must use an 'iterate' connector with tRunJob.

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business