Author |
Message
|
Rimsky |
Posted: Mon Mar 28, 2011 5:07 am Post subject: Load Routing Information from a File |
|
|
Newbie
Joined: 28 Mar 2011 Posts: 3
|
Hello,
First of all let me say that loading routing info from a file is not my idea The architect on the project does not want a database to be used by the solution.
So, I have to load the routing information from a file at start up and cache it.
What would be the best approach? I was thinking of something along the lines of this:
Filter_isRoutingCached no-> JavaCompute_LoadRouting -> Compute_CacheRouting -> Compute_PopDestList
Filter_isRoutingCached yes -------------------------------------------------------------------------> Compute_PopDestList
LoadRouting would load the routing info and load it into the local environment and pass it and the original message to CacheRouting that would save it in a shared row.
Does that make sense?
Any better ideas?
TIA
R |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Mar 28, 2011 5:33 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
And what happens when the Broker is restarted? Where is the file that has been read by the file input node?
Is this architect from a Java background by any chance? This is not to sleight Java defs but this does seem IMHO to be a common theme when people move from Jave to Broker. They want to replicate properties files for some strange reason.
As for a better way?
find out how often this data will change (if ever...)
Really, a DB table is IMHO a far better place for this data. _________________ 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 |
|
 |
mqjeff |
Posted: Mon Mar 28, 2011 5:44 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Tons of alternatives here, including sticking it into a user defined configurable service or a user defined property.
Could make it a simple java properties file, and do things to load that.
could use soliddb, not actually "a database".
Could use a FileInput node that processed the file and stuck it into the cache.
Could use the Cache supportPac. |
|
Back to top |
|
 |
Rimsky |
Posted: Mon Mar 28, 2011 5:47 am Post subject: |
|
|
Newbie
Joined: 28 Mar 2011 Posts: 3
|
Thanks for the reply.
File is on the broker box somewhere (exactly where is TBD)
The input message will be the payload that needs routing.
Architect's background certainly isn't message broker. He is trying to minimise support overheads and errors if/when DB is unavailable. Also all errors are being written to trace files and emails sent you those concerned.
Routing data changes rarely. One idea would be to incorporate an input node to which new routing info would be posted to refresh the shared row.
IMHO considering this is supposed to be a an enterprise-wide strategic platform, I do feel that the foundations are shaky. |
|
Back to top |
|
 |
Rimsky |
Posted: Mon Mar 28, 2011 5:57 am Post subject: |
|
|
Newbie
Joined: 28 Mar 2011 Posts: 3
|
Quote: |
Tons of alternatives here, including sticking it into a user defined configurable service or a user defined property. |
Aren't user defined variables pairs only? I need quite a list of parameters.
Quote: |
Could make it a simple java properties file, and do things to load that. |
This is my preferred soln.
Quote: |
could use soliddb, not actually "a database". |
Not in the plan to have this.
Quote: |
Could use a FileInput node that processed the file and stuck it into the cache. |
I considered this. What would the process be? New file written to disk. FileInput node reads it (how often?). Row updated. That is feasible, but routing file would have to be written for every restart of the broker.
Again, are this not pair of data? |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Mar 28, 2011 6:11 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Rimsky wrote: |
Quote: |
Tons of alternatives here, including sticking it into a user defined configurable service or a user defined property. |
Aren't user defined variables pairs only? I need quite a list of parameters.
Quote: |
Could make it a simple java properties file, and do things to load that. |
This is my preferred soln.
Quote: |
could use soliddb, not actually "a database". |
Not in the plan to have this.
Quote: |
Could use a FileInput node that processed the file and stuck it into the cache. |
I considered this. What would the process be? New file written to disk. FileInput node reads it (how often?). Row updated. That is feasible, but routing file would have to be written for every restart of the broker.
Again, are this not pair of data? |
solidDB is really cool. Too bad you can't use this.
If you are going to use a properties file, <#include mqjeff's and rekarm's critique here>, consider running a Singleton in the background and have the Singleton read the properties file at Broker start.
BTW... I am developing a standard disclaimer to include on all my posts, that would reflect recommendations of other posters here in the forum about my advanced solutions. Something like, "don't try this at home", or "professional driver on a closed course", or "don't run with scissors." If any have suggestions on the language, please let me know.
P. S. S. @davies. Please elaborate on the choice of a language influence the outcome. Perhaps start a separate thread. I would enjoy a discussion about your view on Java developers. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 28, 2011 6:23 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Hrm. I'd thought that V7 let you add user defined properties that were tables. You can certainly do it with a user defined node.
You need to consider the scope of the access to these properties that you need, though.
If the scope is going to be limited to a specific flow or set of common flows, you will have one kind of solution.
If instead the intent is to provide common data to ALL flows or to provide a generic mechanism for ALL flows to configure themselves, then you really need to push back against using a file in the first place. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Mar 28, 2011 6:23 am Post subject: Re: Load Routing Information from a File |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Rimsky wrote: |
Hello,
First of all let me say that loading routing info from a file is not my idea The architect on the project does not want a database to be used by the solution.
So, I have to load the routing information from a file at start up and cache it.
What would be the best approach? I was thinking of something along the lines of this:
Filter_isRoutingCached no-> JavaCompute_LoadRouting -> Compute_CacheRouting -> Compute_PopDestList
Filter_isRoutingCached yes -------------------------------------------------------------------------> Compute_PopDestList
LoadRouting would load the routing info and load it into the local environment and pass it and the original message to CacheRouting that would save it in a shared row.
Does that make sense?
Any better ideas?
TIA
R |
If you adopt the Singleton idea, you won't need two separate paths, as you described above. You only need one.
Input -> JCN -> Output
The first time the JCN is hit, it instantiates the Singleton. In the Singleton's constructor, you would put the code to read the properties file. Subsequent calls to JCN will not instantitate the Singleton, since it already exists.
Much simpler, eh? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 28, 2011 6:36 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Of course a singleton only applies to the JVM it runs in, which is to say a specific EG.
So you also have to keep that in mind - again that you can't access data from an EG that does not have this JCN deployed to it. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Mar 28, 2011 6:50 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
mqjeff wrote: |
Of course a singleton only applies to the JVM it runs in, which is to say a specific EG.
So you also have to keep that in mind - again that you can't access data from an EG that does not have this JCN deployed to it. |
True. However, this is static data, and does not need to be shared across EGs, since each EG can have its own Singleton and read the properties file.
<<Insert mqjeff's Advanced Concept Disclaimer here>>
In the event you wanted to share Singleton info between EGs, you could do so via JMX relatively quick and easy. Direct drop-in replacement for R234 coolant. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mgk |
Posted: Mon Mar 28, 2011 9:51 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
In 7.0.0.2 you could use a file read node to get the data... _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|