Hello everyone,
I have a question about the tRunJob component.
I have a job with a Context Group that defines 4 different contexts: Dev, Prod, Sys and UAT (see attached images).
When I export the job as an autonomous job, I have to specify the context I want the job to called with.
What I would like to do is to be able to call my batch file with an argument to specify the context, something like this (from the command line):
UpdateSalesforceWithLastDateTime.bat Prod
and the batch file would be:
%~d0 cd %~dp0 java -Xms256M -Xmx1024M -cp classpath.jar; update_last_date_time.updatesalesforcewithlastdatetime_0_1.UpdateSalesforceWithLastDateTime --context=%1 %*
This way I would be able to reuse the same exported job for all my environments. But this is not possible, because the context to be used when calling the sub-job is hard-coded when the job is exported, so even if I pass the context as an argument, it is not used when the sub-job is run.
So in order for me to be able to run my job in the different environments I have to export it 4 times, one for each of the environments.
On my attempt to achieve this, I inspected the option "Use dynamic job" within the tRunJob component (see configuration on attachment).
My expectation was to be able to specify the "Context Job" and the "Context" attributes of the tRunJob as context variables; this way I would be able to control the context that is passed on to the sub-job.
However, this is what happened:
- The "Context Job" attribute can be passed from the context; so in my example, the "context.subjob" variable was replaced with "UpdateSalesforce" and the subjob is called as expected
- The "Context" attribute needs to have a value of an existing context group, its value cannot be passed from a context variable; so in my example, the "context.contextValue" variable was not replaced with "Prod" as I was expecting, but it used the value "context.contextValue", which does not exist in the Context Group and therefore the default context is used to call the sub-job (in this example the default context is "Dev")
Does anyone know if there is a way of achieving what I am looking for? Is this anything that is being added in future releases of Talend?
Thanks in advance,
Julipool