Author |
Message
|
ganesh |
Posted: Thu Apr 14, 2011 5:46 am Post subject: Version of flow |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
Is it possible to get the version of a flow without using CMCP object? My requirement is my flow will have to read its own version number and write it to a queue and i dont want to hardcode the port number or host name. If we have the host name, portnumber and QMGR We can get the version using the below code, but i would like to know if it is possible to get it using MBElement api?
Code: |
ConfigManagerConnectionParameters cmcp =
new MQConfigManagerConnectionParameters("localhost", 1414, "QMGR");
ConfigManagerProxy cmp = ConfigManagerProxy.getInstance(cmcp);
TopologyProxy t = cmp.getTopology();
BrokerProxy b = t.getBrokerByName("BROKER1");
ExecutionGroupProxy e = b.getExecutionGroupByName("default");
MessageFlowProxy m = e.getMessageFlowByName("mf1");
String version = m.getVersion();
|
|
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 14, 2011 5:59 am Post subject: Re: Version of flow |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
ganesh wrote: |
Is it possible to get the version of a flow without using CMCP object? |
Whether it is possible or not depends a lot on what version of Broker you are using, I'm sure.
ganesh wrote: |
My requirement is my flow will have to read its own version number and write it to a queue |
That's an odd requirement. There are usually better ways to provide auditing verification than having code produce fixed values.
I wonder what the documentation says on things like MQSI keywords. |
|
Back to top |
|
 |
ganesh |
Posted: Wed Apr 20, 2011 5:36 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
Can i query a broker and EG from a deployed message flow having java compute node? I would like to get the list of other deployed objects in the same EG and also their properties..version, deployment time....? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 20, 2011 5:50 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
ganesh wrote: |
Can i query a broker and EG from a deployed message flow having java compute node? I would like to get the list of other deployed objects in the same EG and also their properties..version, deployment time....? |
What happens when you try it?
Also, again, there are likely better ways to do whatever it is you are trying to do.
So what are you actually trying to actually do? |
|
Back to top |
|
 |
ganesh |
Posted: Wed Apr 20, 2011 5:58 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
Quote: |
What happens when you try it?
|
I tried it couple of times and the eg where i deployed the code became unresponsive after that i am little hesitant to do it again. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 20, 2011 6:00 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
ganesh wrote: |
Quote: |
What happens when you try it?
|
I tried it couple of times and the eg where i deployed the code became unresponsive after that i am little hesitant to do it again. |
Then maybe you should try a different way to do whatever it is you are actually trying to do. |
|
Back to top |
|
 |
ganesh |
Posted: Wed Apr 20, 2011 6:33 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
My requirement is deploy the flow which will querry the broker in EG01
1) Get the list of all the other deployed objects in EG01.
2) Get the version info of all other deployed objects in EG01 and queues associated with them. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 20, 2011 6:38 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Your requirement is run those queries.
Why does it need to be a message flow that runs those queries?
What is the use that the results of those queries are going to be put to? |
|
Back to top |
|
 |
ganesh |
Posted: Wed Apr 20, 2011 6:56 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
Quote: |
Why does it need to be a message flow that runs those queries?
|
I completely agree with you that we dont need message flows to do that, it can be attained in a java classs using CMP classes but trying it out the other way to see whether it works. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 20, 2011 7:34 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ganesh wrote: |
trying it out the other way to see whether it works. |
I think you've proved it doesn't.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 20, 2011 8:06 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
ganesh wrote: |
trying it out the other way to see whether it works. |
I think you've proved it doesn't.  |
I think it's been shown that the code that ganesh wrote caused problems when run inside a JCN.
That is not the same thing as saying you can't run CMP API apps inside a JCN.
Nor the same thing as saying whether you SHOULD do so or NOT DO so. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 20, 2011 8:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Vitor wrote: |
ganesh wrote: |
trying it out the other way to see whether it works. |
I think you've proved it doesn't.  |
I think it's been shown that the code that ganesh wrote caused problems when run inside a JCN.
That is not the same thing as saying you can't run CMP API apps inside a JCN.
Nor the same thing as saying whether you SHOULD do so or NOT DO so. |
I was exactly referring to the attempt to obtain this information from inside a flow, and apolgise generally for my lack of clarity & precision.
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ganesh |
Posted: Wed Apr 20, 2011 8:15 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
I will try it once again with better exception handling mechanism and let you know the outcome. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 20, 2011 8:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You may also wish to pay attention to how you create and free MbElements. |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Apr 20, 2011 4:42 pm Post subject: Re: Version of flow |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
ganesh wrote: |
Is it possible to get the version of a flow without using CMCP object? ... i would like to know if it is possible to get it using MBElement api? |
No, and no.
It might be better to put the version information in keywords, within static strings in ESQL.
ganesh wrote: |
My requirement is my flow will have to read its own version number and write it to a queue and i dont want to hardcode the port number or host name. |
It is possible to put these parameters in a property file instead, and then use one of these other CMCP classes:- MQPropertyFileConfigManagerConnectionParameters (v6.x)
- MQPropertyFileBrokerConnectionParameters (v7.x)
It is also possible to put the CMP API code inside a JCN. Whether it's a good idea or not is a separate matter. It may take a relatively long time to run though, so much so that it seems unresponsive. How long does it take to run outside a JCN? It certainly won't run any faster inside a JCN. Putting at least some of the CMP API code in a JCN static initializer block (rather than in the evaluate() method) could help, so that the long running code would only run once during EG startup, rather than once for each transaction. Pay extra attention to handling exceptions and timeouts properly. |
|
Back to top |
|
 |
|