File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes IBM MQ :: getting MQQueueConnection object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "IBM MQ :: getting MQQueueConnection object" Watch "IBM MQ :: getting MQQueueConnection object" New topic
Author

IBM MQ :: getting MQQueueConnection object

Balaji VR
Ranch Hand

Joined: Mar 22, 2006
Posts: 76
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 ]

Bala<br />SCJP 1.4 98%<br />SCBCD 1.3 -- 88%
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
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

Joined: Mar 22, 2006
Posts: 76
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!
Jianfeng Qian
Ranch Hand

Joined: Jan 25, 2005
Posts: 83
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.
"


Jianfeng Qian<br />SCJP 1.4, SCBCD 5.0(beta)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: IBM MQ :: getting MQQueueConnection object
 
Similar Threads
Not able to Send message from JBoss to Websphere MQ
IBM MQ 'remote put' problem
When does our JMS application actually initiates/starts the connection with queue?
MQ - Server Bindings
When does our JMS application actually initiates/starts the connection with queue?