MQQueueManager

public class MQQueueManager
extends MQManagedObject
java.lang.Object
   |
   +----com.ibm.mq.MQManagedObject
           |
           +----com.ibm.mq.MQQueueManager
          

The MQQueueManager class provides a connection to a WebSphere MQ queue manager.

An MQQueueManager object (and any queues or processes accessed through it) can be shared between multiple threads, but be aware that access to the WebSphere MQ queue manager itself is synchronized, so that only one thread can communicate with it at any one time. A call to MQQueue.get() specifying MQC.MQGMO_WAIT (for example) will therefore block any other threads attempting to make WebSphere MQ calls using the same MQQueueManager until the get completes.

Constructors

MQQueueManager

public MQQueueManager(String queueManagerName) throws MQException;

Creates a connection to the named queue manager.

The host name, channel name and port to use during the connection request are specified in the MQEnvironment class. This must be done before calling this constructor.

The following example shows a connection to a queue manager "MYQM", running on a system with host name "fred.mq.com".

MQEnvironment.hostname = "fred.mq.com";  // host to connect to
MQEnvironment.port     = -1  ;           // port to connect to.  If not set,
                                         // this defaults to 1414 for WebSphere MQ
                                         // client connections.
MQEnvironment.channel  = "channel.name"; // the CASE-SENSITIVE name of the SVRCONN
                                         // channel on the queue manager
MQQueueManager qMgr    = new MQQueueManager("MYQM");
 

If the queue manager name is null or blank, then a connection is made to the default queue manager.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, 
                      ConnectionManager connectionManager) 
              throws MQException;

Creates a connection to the named queue manager specifying a connection manager.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, Hashtable properties) 
              throws MQException;

Creates a connection to the named queue manager using a Hashtable. The Hashtable overrides the specification held in MQEnvironment.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, Hashtable properties, 
                      ConnectionManager connectionManager) 
              throws MQException;

Creates a connection to the named queue manager using given Hashtable and connection manager. The given properties override those held in MQEnvironment.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, Hashtable properties, 
                      MQConnectionManager connectionManager) 
              throws MQException;

Creates a connection to a queue manager which overrides the settings in MQEnvironment class with those in the given Hashtable.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, Hashtable properties, 
                      URL url) throws MQException;

Creates a connection to the named queue manager using a channel definition table. Using a client channel definition table enables alternative channel definitions to be defined. The constructor selects a set of definitions from the table and these are used instead of any settings held in MQEnvironment class when opening a channel. Properties other than those defined by the client channel definition table can be supplied with this constructor.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, int options) 
              throws MQException;

Creates a connection to the named queue manager specifying binding options.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, int options, 
                      ConnectionManager connectionManager) 
              throws MQException;

Creates a connection to the named queue manager specifying bindings options and a connection manager.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, int options, 
                      MQConnectionManager connectionManager) 
              throws MQException;

Creates a connection to a queue manager allowing binding options to be specified. It also allows a connection manager to be specified.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, 
                      MQConnectionManager connectionManager) 
              throws MQException;

Creates a connection to a named queue manager using a connection manager.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, URL url) 
              throws MQException;

Creates a connection to the named queue manager using a channel definition table. Using a client channel definition table enables alternative channel definitions to be defined. The constructor selects a set of definitions from the table and these are used instead of any settings held in MQEnvironment class when opening a channel.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, URL url, 
                      ConnectionManager connectionManager) 
              throws MQException;

Creates a connection to the named queue manager using a client channel definition table. Using a client channel definition table enables alternative channel definitions to be defined. The constructor selects a set of definitions from the table and these are used instead of any settings held in MQEnvironment class when opening a channel. The channel definition that is used must specify this queue manager name. This full name is passed onto the queue manager during a connect, but the queue manager that is ultimately connected to might not have the same name as specified here after the "*" "*" or "" or a name which consists entirely of blanks is passed in. The actual queue manager name is disregarded when a channel definition is being selected.

Parameters
Exceptions

MQQueueManager

public MQQueueManager(String queueManagerName, URL url, 
                      MQConnectionManager connectionManager) 
              throws MQException;

Creates a connection to the named queue manager using a client channel definition table. Using a client channel definition table enables alternative channel definitions to be defined. The constructor selects a set of definitions from the table and these are used instead of any settings held in MQEnvironment class when opening a channel.

Parameters
Exceptions

Fields

isConnected

public boolean

Deprecated

Use the isConnected() method instead.

Indicates whether this MQQueueManager object is currently connected to a WebSphere MQ queue manager. Use the disconnect method to disconnect from a queue manager.

Methods

accessDistributionList

public MQDistributionList accessDistributionList(MQDistributionListItem[] items,

                                                 int options) 
              throws MQException;

Creates a distribution list using the default alternative user ID.

Parameters
Returns
Exceptions

accessDistributionList

public MQDistributionList accessDistributionList(MQDistributionListItem[] items,

                                                 int options, 
                                                 String id) 
              throws MQException;

Creates a distribution list.

Parameters
Returns
Exceptions

accessProcess

public MQProcess accessProcess(String processName, int openOptions) 
              throws MQException;

Accesses a WebSphere MQ process on this queue manager using default queue manager name and alternative user ID values.

Parameters
Returns
Exceptions

accessProcess

public MQProcess accessProcess(String processName, int openOptions, 
                               String queueManagerName, 
                               String alternateUserId) 
              throws MQException;

Establishes access to a WebSphere MQ process on this queue manager in order to inquire about the process attributes.

Parameters
Returns
Exceptions

accessQueue

public MQQueue accessQueue(String queueName, int openOptions) 
              throws MQException;

Establishes access to an WebSphere MQ queue on this queue manager using default queue manager name and alternative user ID values.

Parameters
Returns
Exceptions

accessQueue

public MQQueue accessQueue(String queueName, int openOptions, 
                           String queueManagerName, 
                           String dynamicQueueName, 
                           String alternateUserId) 
              throws MQException;

Establishes access to a WebSphere MQ queue on this queue manager in order to get or browse messages, put messages, inquire about the attributes of the queue, or set the attributes of the queue.

If the queue named is a model queue, then a dynamic local queue is created. The name of the created queue is held in the name field of the returned MQQueue object.

Parameters
Returns
Exceptions

backout

public void backout() throws MQException;

Indicates to the queue manager that all the message gets and puts that have occurred since the last syncpoint are to be backed out. Messages sent as part of a unit of work (with the MQC.MQPMO_SYNCPOINT flag set in the options field of MQPutMessageOptions) are deleted. Messages retrieved as part of a unit of work (with the MQC.MQGMO_SYNCPOINT flag set in MQGetMessageOptions.options) are reinstated on the queue.

Exceptions

begin

public void begin() throws MQException;

Begins a new unit of work. This method is only supported by WebSphere MQ in a bindings connection. It signals to the queue manager that a new unit of work is to begin.

Exceptions

commit

public void commit() throws MQException;

Indicates to the queue manager that the application has reached a syncpoint. All the message gets and puts that have occurred since the last syncpoint are to be made permanent. Messages sent as part of a unit of work (with the MQC.MQPMO_SYNCPOINT flag set in MQPutMessageOptions.options) are made available to other applications. Messages retrieved as part of a unit of work (with the MQC.MQGMO_SYNCPOINT flag set in MQGetMessageOptions.options) are deleted.

Exceptions

disconnect

public void disconnect() throws MQException;

Ends the connection to the queue manager. All open queues and processes accessed through this queue manager are closed and become unusable. The only way to reconnect is to create a new MQQueueManager object.

Exceptions

getCCDTURL

public URL getCCDTURL();

Returns the URL of the channel definition file, or null if it does not exist. Java URLs support various protocols, which normally include file, HTTP, FTP and LDAP. The URL class has several constructors, one of which is: URL(String spec).

Returns

getCharacterSet

public int getCharacterSet() throws MQException;

Gets the CCSID (Coded Character Set Identifier) of the queue manager's codeset. This defines the character set used by the queue manager for all character string fields in the application programming interface.

Returns
Exceptions

getCommandInputQueueName

public String getCommandInputQueueName() throws MQException;

Gets the name of the command input queue defined on the queue manager. This is a queue to which applications can send commands, if authorized to do so.

Returns
Exceptions

getCommandLevel

public int getCommandLevel() throws MQException;

Indicates the level of system control commands supported by the queue manager. The set of system control commands corresponding to a particular command level varies according to the platform on which the queue manager is running. See WebSphere MQ Application Programming Reference.

Returns
Exceptions

getDistributionListCapable

public boolean getDistributionListCapable();

Indicates whether the queue manager supports distribution lists.

Returns

getJDBCConnection

public Connection getJDBCConnection(XADataSource xads) throws MQException, 
            SQLException, Exception;

Returns a Connection object for use with the JTA-JDBC support.

Parameters
Returns
Exceptions

getJDBCConnection

public Connection getJDBCConnection(XADataSource xads, String userid, 
                                    String password) 
              throws MQException, SQLException, Exception;

Registers a database for coordination. Used to create a JDBC Connection which is coordinated by the queue manager after a call to begin.

Parameters
Returns
Exceptions

getMaximumMessageLength

public int getMaximumMessageLength() throws MQException;

Gets the maximum length of a message that the queue manager can handle. No queue can be defined with a maximum message length greater than this.

Returns
Exceptions

getMaximumPriority

public int getMaximumPriority() throws MQException;

Gets the maximum message priority supported by the queue manager. Priorities range from zero (lowest) to this value.

Returns
Exceptions

getProperties

public static Hashtable getProperties(Object key, MQChannelHeader header, 
                                      URL url) throws IOException, 
            MQException;

Reads properties concerning a channel in the channel definition table.

Parameters
Returns
Exceptions

getSyncpointAvailability

public int getSyncpointAvailability() throws MQException;

Indicates whether the queue manager supports units of work and syncpointing with the MQQueue.get() and MQQueue.put() methods.

Returns
Exceptions

isConnected

public boolean isConnected();

Indicates whether this object is currently connected to a WebSphere MQ queue manager. Use disconnect() to disconnect from a queue manager.

Returns

put

public void put(String qName, MQMessage msg) throws MQException;

Puts a single message on to a (possibly unopened) queue. If a send exit has been specified it processes the message before it is sent.

Parameters
Exceptions

put

public void put(String qName, MQMessage msg, MQPutMessageOptions pmo) 
              throws MQException;

Puts a single message on to a (possibly unopened) queue. If a send exit has been specified it processes the message before it is sent.

Parameters
Exceptions

put

public void put(String qName, String qmName, MQMessage msg) 
              throws MQException;

Puts a single message on to a (possibly unopened) queue. If a send exit has been specified it processes the message before it is sent.

Parameters
Exceptions

put

public void put(String qName, String qmName, MQMessage msg, 
                MQPutMessageOptions pmo) throws MQException;

Puts a single message on to a (possibly unopened) queue. If a send exit has been specified it processes the message before it is sent.

Parameters
Exceptions

put

public void put(String qName, String qmName, MQMessage msg, 
                MQPutMessageOptions pmo, String altUserId) 
              throws MQException;

Puts a single message onto a (possibly unopened) queue. If a send exit has been specified, it processes the message before it is sent. See the description of MQPUT1 in WebSphere MQ Application Programming Reference for more information.

Parameters
Exceptions