Search code examples
talend

How to force a child job with tRunJob to use the same context as the parent job?


I have a route in Talend ESB (SE) 6.5.1 which calls a Talend job with cTalendJob and this has a radio-button option "Use Route Context" which is great - if my route is DEV context, so it my job.

However, when I've tried to move job this to another context (in runtime), I've hit upon a problem with a child-job. My job calls a child-job with tRunJob, in which Context is a mandatory parameter and there is no option for "current" or something similar. So when I call my route with context TEST, then the job called buy cTalendJob is picking up the route context (TEST), but the child-job is still picking up the DEV context.

The only ways I can see of forcing the correct context in the child-job are to

  • check the Transmit whole context option, but that will only work if all the context options in my child-job are also present in the parent-job which is annoying and potentially risky.

  • use dynamic job (even though it isn't) and specify the current context as a context parameter itself. Again it's ugly, possibly less efficient and also potentially problematic.

Surely there must be a better solution? This would seem to be really key to the whole point of contexts.

Thanks for looking!


Solution

  • Unfortunately no, the right way to do it is to load the context both in the parent and child job and to check "Transmit whole context". It's not risky if you define your context in "Contexts" and use the same context in both.