One Star

Using context variable in a mediation route (ESB 6.3)

Hello,

I have a weird problem while using context variables in mediation routes with Talend ESB 6.3.1

 

I have no idea how to join the .zip of my route in here, but you can reproduce very easily :

 

cTimer -> cDirect (setVar) -> cLog (output message : context.var)

cDirect (setVar) -> cProcessor (context.var = "Fixed") -> cLog (output message : context.var) 

image.png

 

My route is a bit more complex because I also tried to System.out.println the context variable, and use it in the "When" link of a message Router. Result is shown below :

 

image.png

 

Here it is, in the cProcessor called "setting context var", I print it, the fix it to "fixed", then print it again : it works.

Then, the cLog2 prints it, but it shows the default value, not "fixed". Why ?

Same for the cLog1 in the first route, it shows "default", however the cProcessor shows the value "fixed" right after cLog1!

Without any surprise, this context variable in the message router has the "default" value instead of "fixed".

 

Why does it behave like this ? Is there something I missed somewhere ?

 

Thanks in advance

 

 

  • ESB
2 REPLIES
Nine Stars

Re: Using context variable in a mediation route (ESB 6.3)

I'm not very familiar with Talend ESB, but with no connection between the subjobs, I'm guessing they run simultaneously. If that's true, the execution order will be unpredictable.
Nine Stars

Re: Using context variable in a mediation route (ESB 6.3)

as @cterenzi suggest - need to check how the routes executed, You can run it in debug mode 

 

generally - it work, for example - below part of job, which catch exceptions from real-time flow, but send email not more often than 1 per 30 minutes

 

Screen Shot 2017-06-09 at 2.42.30 PM.png

 

Other part of this Job use variables as well, but I never mix them between parts

-----------