Context not passed from route to job

One Star

Context not passed from route to job

Hello
I use a same repository context group in my route and the job it calls.
The problem is the value of the context in the route are never passed to the job, for instance, in my cTalendJob basic settings :

I checked with System.out.print that context.SoapMessage  contains something in my route before calling the job, but in the job it is always empty.
NB : it works in the 2nd line with constant value "toto"
The Talend component help only shows constants passed to the job. How can we pass variable contexts ?
Thank you
Loko
One Star

Re: Context not passed from route to job

Hi,
You can use header:
1-In the route use a cSetHeader to assign you context variable to a header field.

2-Then call you job with a cTalendJob component.

3-Then use the header field in your job.

Eric
One Star

Re: Context not passed from route to job

OK thank you Eric for this workaround.
But in this case, I'm still wondering when thoses Context Param between Route and job are supposed to be used and when they work.
Loko
One Star

Re: Context not passed from route to job

The context param you see in cTalendJob components are the contexts of your job. Not the ones of your route.
One Star

Re: Context not passed from route to job

So Context param can only accept static values ? If so, they're pretty useless, I guess.
The cTalendJob component (not the job itself) is on the route level, thus I think it should know the route contexts and use them as value for the Context Params to the job.