Author |
Message
|
pcelari |
Posted: Fri Jun 17, 2011 7:39 am Post subject: Possible to share procedures outside of an ESQL module? |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Is it possible to define a procedure outside any module?
it would be great if a shared procedure can be defined just like a shared variable that can be used outside any module definition.
Specifically, I'm expanding the routing sample with cached routing table in a share variable cachedQueueTable. But I also want to have the updateCache() be shared by other flows that also use the same routing table.
It would be highly flexible If I can use the same procedure, in an ATOMIC BLOCK, outside its module.
Has anyone tried such arrangement? I'll make sure all flows are deployed to the same EG.
Appreciate any sharing of your insight.
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Jun 17, 2011 8:37 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Yes, you can. An easy way to do this is in a Jar file. The common procedure can be called from ESQL or JCN. If you need to share data also, you can through a Singleton. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
pcelari |
Posted: Fri Jun 17, 2011 9:06 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Thank you.
is it possible to do it in ESQL? I don't know Java so much to use it in WMB. _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Jun 17, 2011 9:13 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
ESQL is interpreted by the WMB binary. There are several major customers who have elevated a request to IBM for dynamically loaded ESQL modules. AFAIK, so far, this feature is not in version 8; mqjeff or rekarm may like to comment on it.
You may consider learning Java. Java is easy to learn and there are many free tutorials available on the net. You may have a friend that can help you. Java is universal and you won't go wrong in your career knowing it. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jun 17, 2011 9:48 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
ESQL is interpreted by the WMB binary. There are several major customers who have elevated a request to IBM for dynamically loaded ESQL modules. AFAIK, so far, this feature is not in version 8; mqjeff or rekarm may like to comment on it. |
I don't see how we could. Even if we did know.
But you can declare procedures in Schema scope, afaik, outside of Module scope. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jun 17, 2011 1:56 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mqjeff wrote: |
lancelotlinc wrote: |
ESQL is interpreted by the WMB binary. There are several major customers who have elevated a request to IBM for dynamically loaded ESQL modules. AFAIK, so far, this feature is not in version 8; mqjeff or rekarm may like to comment on it. |
I don't see how we could. Even if we did know.
But you can declare procedures in Schema scope, afaik, outside of Module scope. |
Or you can declare your procedure in any schema scope and import the schema into your scope (hint lookup the PATH statement) and make sure the relevant project is referenced
Be aware however that there is no access to InputRoot or OutputRoot.
They would have to be passed as references...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rekarm01 |
Posted: Sun Jun 19, 2011 5:08 pm Post subject: Re: Possible to share procedures outside of an ESQL module? |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
pcelari wrote: |
Specifically, I'm expanding the routing sample with cached routing table in a share variable cachedQueueTable. But I also want to have the updateCache() be shared by other flows that also use the same routing table. |
Message flows don't actually share ESQL variables with each other. Different flows would not be using the same routing table; each message flow would have its own independent copy. Depending on the requirements, that may or may not be a problem.
Otherwise, if it's actually necessary to share the same data between multiple message flows, either use a database, or use custom cache nodes (e.g. SupportPac IA91), or (within the same EG), use a Java class variable. Java, like ESQL, requires some form of synchronization to access shared data; a Java novice might require additional help to do that correctly.
fjb_saper wrote: |
you can declare your procedure in any schema scope and import the schema into your scope (hint lookup the PATH statement) and make sure the relevant project is referenced |
Likewise, message flows don't actually share ESQL procedures with each other, either; each flow would have its own independent copy of the imported code, and possibly different versions between them. That's usually not a problem, but it is a project dependency to take into account when managing source code, and rebuilding and redeploying barfiles.
lancelotlinc wrote: |
There are several major customers who have elevated a request to IBM for dynamically loaded ESQL modules. AFAIK, so far, this feature is not in version 8; mqjeff or rekarm may like to comment on it. |
Ugh. It's difficult enough already to keep track of what's actually running in the broker. What problem is this feature supposed to solve? More importantly, how does this address the OP's issue? Or is this a separate topic? |
|
Back to top |
|
 |
pcelari |
Posted: Mon Jun 20, 2011 4:54 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Thank you for all the insights, which have given different perspectives to the original question.
Now I see, it is better to avoid sharing the same variable across different flows as it may post a nightmare for maintenance and code management.
I also realized, even if different flows use the same database routing table, using different shared variables would be a better choice. Syncrhonizing them all with the the routing table can be easily accomplished by the chaining of different cache refresher flows by making the output from one refresher flow the input for another, which is very easy to accomplish.
Again, thank you all for the sharing your insight!
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Jun 20, 2011 5:23 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
@ pcelari: Sharing the same variable across different flows is very easy to do, with about twelve lines of code. I wouldn't give up on your dream yet.
@rekarm: probably needs a separate topic and not my idea, so if it is important to others, they should jump in and elaborate. As I understood the requirement from a past client of mine in the banking industry, they wanted to be able to load (read that "replace existing") fresh ESQL code without having to reboot the runtime. Much like a DLL or a Jar file with a reload cache button. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
rekarm01 |
Posted: Mon Jun 20, 2011 8:28 pm Post subject: Possible to share procedures outside of an ESQL module? |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
lancelotlinc wrote: |
@pcelari: Sharing the same variable across different flows is very easy to do, with about twelve lines of code. I wouldn't give up on your dream yet. |
Sharing the same ESQL variable across different flows is very impossible to do.
Sharing the same Java class variable is easier, but would probably take more than twelve lines of code.
It's still not clear that pcelari needs to do either of these things.
lancelotlinc wrote: |
@rekarm: probably needs a separate topic |
OK. Until then, ... |
|
Back to top |
|
 |
|