Author |
Message
|
saturn_cemk |
Posted: Sun Jun 29, 2008 11:48 pm Post subject: Shared variable across message flows. |
|
|
Novice
Joined: 10 Jul 2006 Posts: 16
|
Hi all,
I have the following scenario (am using MB6.0)
1. There are two message flows (will refer to them as Flow1 and Flow2) deployed under the same EG. I have declared a SHARED Variable outside the module with a default value within Flow1.
2. I SET the value of the SHARED Variable using some element value from the Input Message.
3. I want to access this SHARED Variable from Flow2.
As far as my knowledge goes, the new value (one being SET in Flow1) of the SHARED Variable will die once the execution of Flow1 finishes (however the default value persists). This is an expected behavior.
Is there a round about way of handling this situation ? I am not thinking of using the 'Cache Support Pack' as of now.
Also does MB6.1 support this kind of a scenario ?
Thanks. |
|
Back to top |
|
 |
Gaya3 |
Posted: Mon Jun 30, 2008 1:11 am Post subject: |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
There is something you have to know about
ATOMIC variables
EXTERNAL variables
Please have a look of the above two, it will help you to find the solution _________________ Regards
Gayathri
-----------------------------------------------
Do Something Before you Die |
|
Back to top |
|
 |
golam1983 |
Posted: Mon Jun 30, 2008 3:51 am Post subject: |
|
|
 Apprentice
Joined: 27 Jun 2008 Posts: 35
|
I think ATOMIC is not a variable... its an statement to prevent to access in use shared variable..
EXTERNAL variable is for something to use with user defined properties....
moreover we can't edit once initialize... |
|
Back to top |
|
 |
Bill.Matthews |
Posted: Mon Jun 30, 2008 4:50 am Post subject: |
|
|
 Master
Joined: 23 Sep 2003 Posts: 232 Location: IBM (Retired)
|
A SHARED variable is only available for the same message flow in the same EG. Thus, in your example - Flow1 and Flow2 would not see the same SHARED variable.
You may want to investigate the SupportPacs. _________________ Bill Matthews |
|
Back to top |
|
 |
AkankshA |
Posted: Mon Jun 30, 2008 11:29 pm Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
golam1983 wrote: |
I think ATOMIC is not a variable... its an statement to prevent to access in use shared variable..
EXTERNAL variable is for something to use with user defined properties....
moreover we can't edit once initialize... |
We can edit external variable once set.... at runtime too...
external shall fulfill ur requirement _________________ Cheers |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jul 01, 2008 3:50 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
An example of one use of this type of ESQL is:-
Where variable declared as EXTERNAL & used in conjunction with the ATOMIC statement to share data between different instances of the same Flow.
I used a set of EXTERNAL variables to hold counters of messages sent. These were updated by a common bit of ESQL that did the update inside an ATOMIC section so that the counter could be only be updated by one instance at a time.
A Timer node was set to run every 10 seconds. This (again in an ATOMIC) section copied the current counts to another set of variables, and zeroed the original counts. Once outide the ATOMIC control, the new values were updated in a Database.
This have been in production use for getting on for 1.5 years now and processes over 500,000 messages per day and has given perfectly accurate results to date. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|