Building a connection

You normally build connections indirectly using a connection factory. A JNDI namespace can store a configured factory, therefore insulating the JMS application from provider-specific information. See the section Using JNDI, below, for details on how to store and retrieve objects using JNDI.

If a JNDI namespace is not available, you can create factory objects at runtime. However, this reduces the portability of the JMS application because it requires references to MQe specific classes. The following code creates a QueueConnectionFactory. The factory uses an MQe queue manager that is configured with an initialisation (ini) file:
QueueConnectionFactory factory; 
factory = new com.ibm.mqe.jms.MQeJNDIQueueConnectionFactory(); 
((com.ibm.mqe.jms.MQeJNDIQueueConnectionFactory)factory).
setIniFileName(<initialisation file>)

Using the factory to create a connection

Use the createQueueConnection() to create a QueueConnection:
QueueConnection connection;
connection = factory.createQueueConnection();

Terms of use | WebSphere software

(c) Copyright IBM Corporation 2004, 2005. All rights reserved.