Reputation: 189
I want to develop a Talend job parent job which will read a file. This file will have all the child job names. So the parent job when run must go through each entry in the file (ie each child job name) and execute the child job. Can anyone please guide me on this.
Upvotes: 0
Views: 2604
Reputation: 3973
You can use the tRunJob dynamic job feature, I executed 3 sub jobs called a, b and c, and the order is specified in the file, see below :
First block is to load your file into context, you can use a properties file or delimited file.
I used properties file with this content :
jobs=a;c;b;a
You have to add a string typed context variable named jobs
to put the propertie value into.
Now, our job list is stored in a context variable, we need to iterate through them using tJavaFlex and update a context variable called currentjob
:
And finally, this is how to set tRunJob component:
Here you specify jobs to be executed, but the execution order is specified by the file !
Upvotes: 1
Reputation: 2774
You can do it like following scenario
This is the sample job which I tried out.
I have assumed your input from CSV file and the input file contain three job name which are
ChildJob1
ChildJob2
ChildJob3
I am getting the jobname and assigning it to a context variable like below
Then that context variable is used in tRunJob
component.
Each child job has a single tjava
component which displays the jobname
Hope this may help you out.
Upvotes: 0