Author |
Message
|
kash3338 |
Posted: Wed Jan 11, 2012 3:29 am Post subject: Reading a configurable file in flow |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
Hi,
Is there a way to read a ".properties" file or any other configurable file from within my message flow other than using Java? |
|
Back to top |
|
 |
zpat |
Posted: Wed Jan 11, 2012 3:38 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
FileRead node.
However try to use WMB user configurable services or UDP bar overrides (external variables) in preference as it's more internal to WMB that way. |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jan 11, 2012 4:22 am Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
zpat wrote: |
FileRead node.
However try to use WMB user configurable services or UDP bar overrides (external variables) in preference as it's more internal to WMB that way. |
I am sorry, i missed mentioning the version. Its v6.1 that we use, which does not have a FileRead node.
By using UDP, I will have to redeploy every time I change my settings, which I want to avoid. Also, can you please elaborate on User Configurable Services? |
|
Back to top |
|
 |
zpat |
Posted: Wed Jan 11, 2012 4:59 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
User configurable services, are just one of many configurable services - documented in the info center.
You could also read a database entry. To avoid doing this repeatedly you could store the data in a shared variable and refresh it at intervals. |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Wed Jan 11, 2012 5:14 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
and instead of database you can persist the configurable settings for example in the xml document to queue too and use MQGet -node to fetch those when internal chache is empty or refresh needed any other way.
--
Marko |
|
Back to top |
|
 |
zpat |
Posted: Wed Jan 11, 2012 6:12 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Yes, browsing a queue with MQGet is good way to pick up static values and then use shared variables to cache them. |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Jan 11, 2012 6:19 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Only if you remember to make the messages persistent..... _________________ 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 |
|
 |
Esa |
Posted: Wed Jan 11, 2012 6:40 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
zpat wrote: |
Yes, browsing a queue with MQGet is good way to pick up static values and then use shared variables to cache them. |
I don't consider this an ideal solution - from administrave point of view. But it's probably the best you can get if you are running < V7.0.2 or don't want to use java.
Last spring I requested IBM an MQSubRq node that would be used to get a retained publication. Ideal for that kind of configuration messages, because there can only be one retained publication per topic at the time. That would make the solution more reliable and remove the extra administrative fuzzle of removing old configuration messages. Either my request was not understood by some support level or it was considered irrelevant. I haven't heard anything of it. I still think it's a shame Message Broker doesn't support the full MQ pubsub API. And there doesn't seem to be much effort towards it, either.
Well, that would not solve the OP's problem anyway, because MB 6.1 does not support MQ 7 pub/sub, if I remember correctly.
zpat wrote: |
User configurable services, are just one of many configurable services - documented in the info center |
UDCS are certainly the future directive. But not applicable in this case because the OP did not want to have java in his cup.
Besides, V 6.1. does not have User Defined Configurable Services. I haven't checked if you can add you own properties to CS's that are not user defined, but FTP Server CS has a nice number of properties that you could use for your own purposes. Not that I'm recommending that kind of heresy  |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jan 11, 2012 6:46 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Esa wrote: |
UDCS are certainly the future directive. But not applicable in this case because the OP did not want to have java in his cup. |
Excluding Java is like wanting to use a pay phone. All the pay phones are removed because everyone has smart phones. It's hard to believe Java still has antagonists 18 years after it was introduced because some faugheys don't want to learn.
Nothing wrong with Assembler, C, C++. RPG or Cobol, and Java is flexible enough to co-exist. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
zpat |
Posted: Wed Jan 11, 2012 7:05 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
The trouble is that Java developers start using Java functions when they should use WMB functions.
So it's fine for experienced WMB developers to add a bit of Java, but it's definitely bad for inexperienced WMB developers - you should see the things I have caught them doing in Java - when WMB has the same function as standard. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 11, 2012 7:07 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Esa wrote: |
Well, that would not solve the OP's problem anyway, because MB 6.1 does not support MQ 7 pub/sub, if I remember correctly. |
No, but it does support pub/sub.
The key point with this post is the very common one; a lot of coders (especially Java people used to WAS but also C, C++) are used to storing values in .properties files and try to import the method blindly. The question is not where do you store properties but what are you storing? The biggest objection raised to UDPs is "I have to redeploy the flow" but if you have the bar file stored (as you should) then it's equivalant to restarting the application to pick up a .properties file.
Also UDPs are covered by the change management process. A .properties file needs to have a security procedure to manage it.
Lastly how often are these properties changing? If they're the names of databases that vary between Test & Prod then IMHO not often, if they're business data not as often as they say! _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Esa |
Posted: Wed Jan 11, 2012 7:59 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Vitor wrote: |
Esa wrote: |
Well, that would not solve the OP's problem anyway, because MB 6.1 does not support MQ 7 pub/sub, if I remember correctly. |
No, but it does support pub/sub.
|
You are right, WMB 6.1 pub/sub had support for retained publications. But it was dropped in V7. I still would not recommend using them unless you are sure that you are not going to migrate to V7...
Vitor wrote: |
Also UDPs are covered by the change management process. A .properties file needs to have a security procedure to manage it.
Lastly how often are these properties changing? If they're the names of databases that vary between Test & Prod then IMHO not often, if they're business data not as often as they say! |
I agree. And very often it's about environment dependent properties, like different settings in test and production environments. These should be tackled with UDP's (and UDCS's).
I like java. It's nice to have in Message Broker and you can get better performing flows with it, if you know exactly what you are doing. But it's not necessary. I am more and more hiding my java code in frameworks, patterns and subflows. I use it for flexible exeption handling and if I need a little more fine-grained control of memory and propagation. But it's not necessary. I wouldn't use it for message transformation. Or rather: I would, but I wouldn't let just anybody else do it. And in V8 there's even less need for java? |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Wed Jan 11, 2012 12:35 pm Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
I agree that built-in functionalities should be used as much as possible --also to configurable properties too.
There are sometimes (good or bad) reasons why one have to extend built-in functionalities with own solution. These reasons and their causes should be documented, discussed and finally made decision (go or not to go) based on them.
For example if you have to provide possibility to your business to change flow's configuration online, you have to find dynamic and user friendly way --sometimes redeployment process can be too clumsy and slow. Sometimes you don't want to use external database for example to reduce license costs or to decrease possible failing points from you HA -configuration etc.
But as discussed earlier, solution depends on the nature of the properties and other demands.
--
Marko |
|
Back to top |
|
 |
|