How to set variable in Route and pass it into cTalendJob in contxtPara

One Star

How to set variable in Route and pass it into cTalendJob in contxtPara

How I can ascribe "exchange.getIn().getMessageId()" to variable and pass it through "ContextParam" in cTalendJob to my Job?  I can pass String like "bla bla bla", but when I try pass variable like ${myVariable}, #{myVariable}, {myVariable}, $myVariable, context.myVariable I get error "myVariable cannot be resolved a variable". Someone knows how to do it?


  
Four Stars

Re: How to set variable in Route and pass it into cTalendJob in contxtPara

Czesc Smiley Wink
if you want to access a contextvariable you need to have it in the context of Job testowyroute already.
better use the globalMap:
in cProcessor1 write : globalMap.put("messid", ......);
in cTalendJob at column wartosci you write: (typeofmessagid)globalMap.get("messid")
HTH
dj
One Star

Re: How to set variable in Route and pass it into cTalendJob in contxtPara

Thx for replay.
I added cProcessor before cTalendJob with this:
import java.util.Map;
Map globalMap = new HashMap();
globalMap.put("messId", "testId");
and in cTalendJob in Context Param this:
(String) globalMap.get("messId")
but I get error "globalMap cannot be resolved". 
Four Stars

Re: How to set variable in Route and pass it into cTalendJob in contxtPara

???
globalMap is a standard Map in the TOS/TIS jobs, no need to declare it.
maybe the ESB architecture/codegeneration differs from TOS.
Sorry, cant help you then
Six Stars

Re: How to set variable in Route and pass it into cTalendJob in contxtPara

It's much easier than you think. The id is already part of the message. You don't need to change the route at all, instead in your job the first component should be a tRouteInput component. The schema of that component will be by default:
 body -> "${in.body}"
 Edit the schema and add a new column of type string: 
messageId -> "${id}"
Then simply assign it to whatever variable you wish from the flow. 
One Star

Re: How to set variable in Route and pass it into cTalendJob in contxtPara

???
globalMap is a standard Map in the TOS/TIS jobs, no need to declare it.
maybe the ESB architecture/codegeneration differs from TOS.
Sorry, cant help you then

yes for jobs, but it does not exist in routes.