|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Extract info from ConnectionFactory |
« View previous topic :: View next topic » |
Author |
Message
|
yeahyeah |
Posted: Sun Aug 06, 2006 6:57 pm Post subject: Extract info from ConnectionFactory |
|
|
Novice
Joined: 06 Aug 2006 Posts: 18 Location: HK
|
Is there any way to extract info like hostname, port and channel from ConnectionFactory obj inside a Java Pgm?
I need to do this because i will need to run a PCF pgm inside this JMS java pgm to clear certain queues, yet, to do so i need the above info to connect to the queue manager. Are there any better way to do this? |
|
Back to top |
|
 |
JohnRodey |
Posted: Tue Aug 15, 2006 4:23 am Post subject: |
|
|
 Centurion
Joined: 13 Apr 2005 Posts: 103
|
Try doing an "instanceof" to check whether your QueueConnectionFactory is an instance of MQQueueConnectionFactory. If it is you should be able to cast it to a MQQueueConnectionFactory and retrieve your information from it. |
|
Back to top |
|
 |
yeahyeah |
Posted: Tue Aug 15, 2006 5:20 pm Post subject: |
|
|
Novice
Joined: 06 Aug 2006 Posts: 18 Location: HK
|
it works~
Thank you  |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Aug 15, 2006 5:48 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
yeahyeah wrote: |
it works~
Thank you  |
I am surprised. I would have expected you'd get a message like MQObject in use?
Anyway from JMS I would have thought that if you needed to empty a queue you could have used a destructive receive....
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
colincrist |
Posted: Wed Aug 16, 2006 11:07 am Post subject: |
|
|
Novice
Joined: 24 Feb 2004 Posts: 22
|
If you want to use reflection then the Jackarta BeanUtils is handy - you can grab an object from somewhere (e.g. JNDI) and not bother about casting. This is useful if you don't want to couple the code to an interface or class.
For example:
Map<String, Object> map = PropertyUtils.describe(bean) ;
or
Object property = PropertyUtils.getProperty("bean", "hostname") ;
It relies on get/set methods following standard bean naming conventions.
I use it in Hermes all the time to create dialogs and so on that can populate a bean for use or render them.
http://jakarta.apache.org/commons/beanutils
Colin.
http://hermesjms.com |
|
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
|
|
|
|