Configuring MQeConnectionFactory

MQeConnectionFactory is the MQe implementation of the javax.jms.ConnectionFactory interface. It is used to generate instances of Connection classes, which for MQe must have a reference to an active queue manager. The ConnectionFactory must be able to create a reference to an active queue manager in order to pass it on to the Connection classes that it generates. The MQeConnectionFactory class can be configured to obtain a reference to a queue manager in the following ways:

However, if neither of these options are suitable then the MQeConnectionFactory class can be extended to provide the required behavior, see Extending MQeConnectionFactory.

To configure a connection factory to start a queue manager itself, it must be given a reference to an initialization (.ini) file that contains all the information it needs to start the queue manager. The connection factory is configured using its setIniFileName() method:

(MQeConnectionFactory(factory)).setIniFileName(filename);

where 'filename' is the name of the initialization file. When the connection factory has been configured with the name of the initialization file, it can either be stored in a JNDI directory, so that it can be looked up by application programs, or it can be used directly in an application program. When the connection factory generates its first Connection it starts the client queue manager using the initialization file and passes a reference to the active queue manager to the Connection. If it generates more Connection classes, it passes them a reference to the same active queue manager. When the last Connection is closed, the connection factory closes the queue manager.

Note: Do not use the MQeQueueManager.close() methods to shut down a queue manager started by a connection factory.

To configure a connection factory to look for an existing queue manager, the initialization file name should be set to null. This is the default value when the MQeConnectionFactory class is created, and it can also be set explicitly using the setIniFileName() method:

(MQeConnectionFactory(factory)).setIniFileName(null);

In this case, when the connection factory generates a Connection, it looks for a queue manager already running in the JVM and passes the Connection a reference to it. An exception is thrown if no queue manager is running. If it generates more Connection classes, it passes them a reference to the same queue manager. When an external queue manager is used, the connection factory does not close the queue manager when the last Connection is closed.

Note: A JVM can run only one MQe queue manager at a time. Therefore, if you use a connection factory to start a queue manager, it should not be used to start the same queue manager in a different JVM, running on the same machine, while the first one is still active.

Terms of use | WebSphere software

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