Author |
Message
|
ein |
Posted: Fri Dec 24, 2010 4:14 am Post subject: How to access the shared varibles |
|
|
Centurion
Joined: 14 Mar 2009 Posts: 108
|
Hi,
I have been working wmb. but i never come across the situation like this.
I am using the WMB 7.0. I declare one shared variables in one of my message flow. I need to use this shared varible in anothermessage flow.
Do i need to re declare the same varibles in another message flow.
As per my knowldge it's not required to declared. But How we can acess it.
The tool kit itself has to display when we press ctrl+space all variables. But it does not show.
Can anybody please help me on this. |
|
Back to top |
|
 |
zpat |
Posted: Fri Dec 24, 2010 4:44 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
You can only access shared variables in other instances of the same message flow. The idea is to pass values from other invocation of a given flow to another, not between different flows (although this would be useful). |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Dec 24, 2010 5:04 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
One technique is to use a Singleton. This allows you to share information between all message flows within an Execution Group.
The first message into the Execution Group automatically creates the Singleton object. It works just like any Java Singleton. Here is a link.
http://en.wikipedia.org/wiki/Singleton_pattern
If you have questions about it, please post. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Dec 24, 2010 5:06 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
One technique is to use a Singleton. This allows you to share information between all message flows within an Execution Group |
This only works within a JavaCompute node, because it's only Java that you have access to things that can run this way.
Well, I guess it might work in a PHPCompute node. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Dec 24, 2010 5:11 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
@mqjeff
Since ESQL can call Java classes in jar files contained within the shared-classes directory, would it not be possible that ESQL Compute nodes also access these shared variables if the Singleton class were published in a jar file to said directory? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Dec 24, 2010 5:16 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
@mqjeff
Since ESQL can call Java classes in jar files contained within the shared-classes directory, would it not be possible that ESQL Compute nodes also access these shared variables if the Singleton class were published in a jar file to said directory? |
That's basically what the Cache supportPac does. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Dec 24, 2010 5:27 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
mqjeff wrote: |
lancelotlinc wrote: |
@mqjeff
Since ESQL can call Java classes in jar files contained within the shared-classes directory, would it not be possible that ESQL Compute nodes also access these shared variables if the Singleton class were published in a jar file to said directory? |
That's basically what the Cache supportPac does. |
I respectfully disagree with your equation. The Cache support pac uses queues to store information. This is wasteful and needless I/O. Singleton is in-memory and fast. No I/O required. The OP just wants to share a simple variable. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Dec 24, 2010 5:36 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
mqjeff wrote: |
lancelotlinc wrote: |
@mqjeff
Since ESQL can call Java classes in jar files contained within the shared-classes directory, would it not be possible that ESQL Compute nodes also access these shared variables if the Singleton class were published in a jar file to said directory? |
That's basically what the Cache supportPac does. |
I respectfully disagree with your equation. The Cache support pac uses queues to store information. This is wasteful and needless I/O. Singleton is in-memory and fast. No I/O required. The OP just wants to share a simple variable. |
First off, I'm forced to disagree with your disagreement. Do you have *any* form of proof of your assertion that IA91 uses queues at all? Documentation that states such?
To the best of my knowledge, the closest it comes is using the RealTime pub/sub to communicated between different Brokers, and for anything that is strictly within the EG, it is indeed all in memory.
Secondly, regardless of whether or not IA91 uses queues, that's not what I said. I said that IA91 used static Java procedures to allow access to it's functionality from ESQL. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Dec 24, 2010 5:43 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
First off, Merry Christmas to you Sir Jeff.
Maybe I need more caffeine, but my eyes show these Pre-reqs for IA91:
Quote: |
Prerequisites
This SupportPac requires:
• WebSphere Message Broker .
• WebSphere MQ (for broker cache).
• V6 only – Requires fix IY77292 or CSD01 for broker level caching
|
The doc
ftp://public.dhe.ibm.com/software/integration/support/supportpacs/individual/ia91.wbimb.pdf
The SupportPac is great if you need a heavy implementation to share variables. It seems to me it is overkill when a one-liner could do the trick through a Singleton class. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Dec 24, 2010 5:52 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
See page 42 of the doc.
Quote: |
Each named Cache uses memory within the JVM of the broker’s execution group. |
 |
|
Back to top |
|
 |
zpat |
Posted: Fri Dec 24, 2010 6:04 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Getting back to shared variables, don't forget to use BEGIN ATOMIC when you update them. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Dec 24, 2010 6:05 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
zpat wrote: |
Getting back to shared variables, don't forget to use BEGIN ATOMIC when you update them. |
In Java, on a Singleton, this would be using the "synchronized" keyword. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Dec 24, 2010 6:07 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
mqjeff wrote: |
See page 42 of the doc.
Quote: |
Each named Cache uses memory within the JVM of the broker’s execution group. |
 |
I surrender to your point, sir. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|