Author |
Message
|
mbsa |
Posted: Wed Jun 12, 2013 4:29 pm Post subject: Environment Variables Behavior |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
Hello, I am using wmb8.0.0.2 and i created a serivice which has 3 operations.
So the service will have one main message flow with soap i/p and saop reply.And the main flow will have 3 subflows to handle catch,failure and timeout.There will also be 3 subflows for 3 operations.
If i create a environment.varaible.msgtype in 2 subflow of the 2 operations and try to acess this environment.varaible.msgtype in catch subflow which is common for all the opeartions.
How will the environment varaible behave when i hit 2 opeartions simultaneously. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 12, 2013 5:31 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The answer to this question lies in understanding what happens when you hit 2 operations simultaneously. |
|
Back to top |
|
 |
mbsa |
Posted: Thu Jun 13, 2013 3:59 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
Hi Jeff,
When i hit 2 operations (xa and xb) simultaneously.The message type for xa opeartion will have environment variable Msgtype as xa and xb opeartion will have environment variable Msgtype as xb. When i try to access the the environment variable Msgtype in fault node which one (xa or xb) will be available. My question is ,there will be any clash while processing these operations simultaneously with same environment variable names.Or they are independent according to each opeartions thread.
Please advice. |
|
Back to top |
|
 |
McueMart |
Posted: Thu Jun 13, 2013 4:07 am Post subject: |
|
|
 Chevalier
Joined: 29 Nov 2011 Posts: 490 Location: UK...somewhere
|
The Environment tree is thread scoped, so variables you set in it are ONLY visible to the current thread. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Jun 13, 2013 4:09 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
You can make them all available, if you think about it long enough:
Code: |
Environment.Variables.XA.Id = 123;
Environment.Variables.XB.Id = 456;
|
If you write:
Code: |
Environment.Variables.Id = 123;
Environment.Variables.Id = 456;
|
Then 456 will be the value in your error handler. Therefore, don't use that construct if you want to evaluate both XA and XB.
If you have multiple flows, use Global Cache rather than Environment. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mbsa |
Posted: Thu Jun 13, 2013 5:12 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
Code: |
Environment.Variables.XA.Id = 123;
Environment.Variables.XB.Id = 456;
|
If i write like this,then in my common error handler i need a logic to pick which one based on XA or XB.I have 18 operations in my service.
Code: |
Environment.Variables.Id = 123;
Environment.Variables.Id = 456;
|
Code: |
Then 456 will be the value in your error handler.
|
Why you think there will be 456?
The operation is XA it will be 123
and if XB it will be 456 if Environment tree is thread scoped,as mentioned by McueMart.
Are they not thread scoped?Please advice. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Jun 13, 2013 5:17 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
You have the technology, you can try it out.
Why post here since you can find this out for yourself through experimentation?
Environment is thread-scoped. Global Cache is not. Hence the recommendation. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|