|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Shared variables |
« View previous topic :: View next topic » |
Author |
Message
|
sudeepm |
Posted: Sun Feb 24, 2008 11:09 pm Post subject: Shared variables |
|
|
Acolyte
Joined: 31 Jan 2008 Posts: 57
|
I need to create a variables which can be used across message flows in java .
Similar to shared variable concept in esql.
i also tried cachenode support pack also. |
|
Back to top |
|
 |
mqpaul |
Posted: Tue Feb 26, 2008 4:23 am Post subject: Some thoughts on shared data in Java |
|
|
 Acolyte
Joined: 14 Jan 2008 Posts: 66 Location: Hursley, UK
|
Here are some initial thoughts. I'm sure there are plenty of other possibilities.
How long should the shared data live, and how do you know when it is dead? In particular, should it persist across an broker/execution group restart, and if not, how do you handle its loss?
- Shared data that persists across restarts needs to be held outside the Java JVM - maybe in a database, maybe in a queue. You might use broker nodes to program their storage and retrieval.
- Shared data that does not persist across restarts could be held in a Java "Singleton". Effectively it's a static object, typically a Map. If you're not familiar with Singletons, seach the web for "Java Singleton Pattern" - for example Wikipedia
- JNDI lets you store data in a network of named items. It's usually more complicated than you need for simple shared data.
- The Java preferences API lets you share data across Java executions, but again, it's probably too complicated for simple sharing.
_________________ Paul |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Feb 26, 2008 4:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you need to share data between message flows in more than one EG or more than one Broker, you need to use something like a queue, a database, or the Cache support pack.
If you use the Cache support pack, following the manual, you can share data between a) nodes in the same flow, b) instances of the same flow, c) instances of the same flow in different EGs, c) instances of different flows in the same EG, d) instances of different flows in different EGs in the same broker, e) instances of different flows in different EGs in different brokers. You can configure the cache node to persist your data into a database, so that it will survive across restarts.
You can change how the data is shared without radically changing your flow code - just the node properties. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mqpaul |
Posted: Tue Feb 26, 2008 6:20 am Post subject: Cache support pack = IA91 |
|
|
 Acolyte
Joined: 14 Jan 2008 Posts: 66 Location: Hursley, UK
|
The cache support pack's official title is "WebSphere BI Message Broker - Broker domain data store", so you might not find it. It's IA91 _________________ Paul |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|