• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IBM MQ :: getting MQQueueConnection object

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to get a MQQueueConnection object from MQQueueConnectionFactory object.
I have copied my code snippet below.

MQConnectionFactory factory = new MQQueueConnectionFactory();
// calls to factory.setQueueManager, setPort, setHostName etc.,
// ...
QueueConnection conn = ((MQQueueConnectionFactory)factory).createQueueConnection();
I am finding this "createQueueConnection()" returning an object of type "javax.jms.QueueConnection". But what I need is an "com.ibm.mq.jms.MQQueueConnection" object.

Please help me.

Thanks.
[ March 20, 2007: Message edited by: Balaji VR ]
 
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
QueueConnection is a JMS inteface, and
com.ibm.mq.jms.MQQueueConnection its implementing class. The recommended way is to use the interface; see, for example, the Sun tutorial for details. If, for some reason, you need the implementing class, you can downcast the interface reference.
 
Balaji VR
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much. I wanted to move to MQ implemented classes from JMS API. I downcasted the code and it works!

conn = (MQQueueConnection)((MQQueueConnectionFactory)factory).createQueueConnection();

Thanks!
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it work?
I think you should use JNDI to lookup a ConnectionFactory instead of new one by yourself.
Some information from javax.jms.ConnectionFactory
"Although the interfaces for administered objects do not explicitly depend on the Java Naming and Directory Interface (JNDI) API, the JMS API establishes the convention that JMS clients find administered objects by looking them up in a JNDI namespace.
"
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic