ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Extract info from ConnectionFactory

Post new topic  Reply to topic
 Extract info from ConnectionFactory « View previous topic :: View next topic » 
Author Message
yeahyeah
PostPosted: Sun Aug 06, 2006 6:57 pm    Post subject: Extract info from ConnectionFactory Reply with quote

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
View user's profile Send private message
JohnRodey
PostPosted: Tue Aug 15, 2006 4:23 am    Post subject: Reply with quote

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
View user's profile Send private message
yeahyeah
PostPosted: Tue Aug 15, 2006 5:20 pm    Post subject: Reply with quote

Novice

Joined: 06 Aug 2006
Posts: 18
Location: HK

it works~
Thank you
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Aug 15, 2006 5:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
colincrist
PostPosted: Wed Aug 16, 2006 11:07 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Extract info from ConnectionFactory
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.