|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
Nested Class Summary | |
static class |
MQQueueManager.MQExitWrapper
|
Field Summary | |
boolean |
isConnected
Deprecated. Use the isConnected method instead. |
Fields inherited from class com.ibm.mq.MQManagedObject |
alternateUserId, closeOptions, connectionReference, isOpen, name, openOptions |
Constructor Summary | |
MQQueueManager(java.lang.String queueManagerName)
Creates a connection to the named queue manager. |
|
MQQueueManager(java.lang.String queueManagerName,
javax.resource.spi.ConnectionManager connectionManager)
Creates a connection to the named queue manager specifying a connection manager. |
|
MQQueueManager(java.lang.String queueManagerName,
java.util.Hashtable properties)
Creates a connection to the named queue manager using a Hashtable. |
|
MQQueueManager(java.lang.String queueManagerName,
java.util.Hashtable properties,
javax.resource.spi.ConnectionManager connectionManager)
Creates a connection to the named queue manager using given Hashtable and connection manager. |
|
MQQueueManager(java.lang.String queueManagerName,
java.util.Hashtable properties,
com.ibm.mq.MQConnectionManager connectionManager)
Creates a connection to a queue manager which overrides the settings in MQEnvironment class with those in the given Hashtable. |
|
MQQueueManager(java.lang.String queueManagerName,
java.util.Hashtable properties,
java.net.URL url)
Creates a connection to the named queue manager using a channel definition table. |
|
MQQueueManager(java.lang.String queueManagerName,
int options)
Creates a connection to the named queue manager specifying binding options. |
|
MQQueueManager(java.lang.String queueManagerName,
int options,
javax.resource.spi.ConnectionManager connectionManager)
Creates a connection to the named queue manager specifying bindings options and a connection manager. |
|
MQQueueManager(java.lang.String queueManagerName,
int options,
com.ibm.mq.MQConnectionManager connectionManager)
Creates a connection to a queue manager allowing binding options to be specified. |
|
MQQueueManager(java.lang.String queueManagerName,
com.ibm.mq.MQConnectionManager connectionManager)
Creates a connection to a named queue manager using a connection manager. |
|
MQQueueManager(java.lang.String queueManagerName,
java.net.URL url)
Creates a connection to the named queue manager using a channel definition table. |
|
MQQueueManager(java.lang.String queueManagerName,
java.net.URL url,
javax.resource.spi.ConnectionManager connectionManager)
Creates a connection to the named queue manager using a client channel definition table. |
|
MQQueueManager(java.lang.String queueManagerName,
java.net.URL url,
com.ibm.mq.MQConnectionManager connectionManager)
Creates a connection to the named queue manager using a client channel definition table. |
Method Summary | |
MQDistributionList |
accessDistributionList(MQDistributionListItem[] items,
int options)
Creates a distribution list using the default alternative user ID. |
MQDistributionList |
accessDistributionList(MQDistributionListItem[] items,
int options,
java.lang.String id)
Creates a distribution list. |
MQProcess |
accessProcess(java.lang.String processName,
int openOptions)
Accesses a WebSphere MQ process on this queue manager using default queue manager name and alternative user ID values. |
MQProcess |
accessProcess(java.lang.String processName,
int openOptions,
java.lang.String queueManagerName,
java.lang.String alternateUserId)
Establishes access to a WebSphere MQ process on this queue manager in order to inquire about the process attributes. |
MQQueue |
accessQueue(java.lang.String queueName,
int openOptions)
Establishes access to an WebSphere MQ queue on this queue manager using default queue manager name and alternative user ID values. |
MQQueue |
accessQueue(java.lang.String queueName,
int openOptions,
java.lang.String queueManagerName,
java.lang.String dynamicQueueName,
java.lang.String alternateUserId)
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. |
void |
backout()
Indicates to the queue manager that all the message gets and puts that have occurred since the last syncpoint are to be backed out. |
void |
begin()
Begins a new unit of work. |
void |
commit()
Indicates to the queue manager that the application has reached a syncpoint. |
void |
disconnect()
Ends the connection to the queue manager. |
java.net.URL |
getCCDTURL()
Returns the URL of the channel definition file, or null if it does not exist. |
int |
getCharacterSet()
Gets the CCSID (Coded Character Set Identifier) of the queue manager's codeset. |
java.lang.String |
getCommandInputQueueName()
Gets the name of the command input queue defined on the queue manager. |
int |
getCommandLevel()
Indicates the level of system control commands supported by the queue manager. |
boolean |
getDistributionListCapable()
Indicates whether the queue manager supports distribution lists. |
java.sql.Connection |
getJDBCConnection(javax.sql.XADataSource xads)
Returns a Connection object for use with the JTA-JDBC support. |
java.sql.Connection |
getJDBCConnection(javax.sql.XADataSource xads,
java.lang.String userid,
java.lang.String password)
Registers a database for coordination. |
int |
getMaximumMessageLength()
Gets the maximum length of a message that the queue manager can handle. |
int |
getMaximumPriority()
Gets the maximum message priority supported by the queue manager. |
static java.util.Hashtable |
getProperties(java.lang.Object key,
MQChannelHeader header,
java.net.URL url)
Reads properties concerning a channel in the channel definition table. |
int |
getSyncpointAvailability()
Indicates whether the queue manager supports units of work and syncpointing with the MQQueue.get() and MQQueue.put() methods. |
boolean |
isConnected()
Indicates whether this object is currently connected to a WebSphere MQ queue manager. |
void |
put(java.lang.String qName,
MQMessage msg)
Puts a single message on to a (possibly unopened) queue. |
void |
put(java.lang.String qName,
MQMessage msg,
MQPutMessageOptions pmo)
Puts a single message on to a (possibly unopened) queue. |
void |
put(java.lang.String qName,
java.lang.String qmName,
MQMessage msg)
Puts a single message on to a (possibly unopened) queue. |
void |
put(java.lang.String qName,
java.lang.String qmName,
MQMessage msg,
MQPutMessageOptions pmo)
Puts a single message on to a (possibly unopened) queue. |
void |
put(java.lang.String qName,
java.lang.String qmName,
MQMessage msg,
MQPutMessageOptions pmo,
java.lang.String altUserId)
Puts a single message onto a (possibly unopened) queue. |
Methods inherited from class com.ibm.mq.MQManagedObject |
close, getAttributeString, getDescription, inquire, isOpen, set, setAttributeString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public boolean isConnected
isConnected
method instead.
disconnect()
method to disconnect from a queue manager.
Constructor Detail |
public MQQueueManager(java.lang.String queueManagerName) throws MQException
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 WebSphereMQ 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.
queueManagerName
- the name of the queue manager to which to connect.
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, int options) throws MQException
queueManagerName
- the name of the queue manager.options
- binding options.
Possible values are:
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, java.util.Hashtable properties) throws MQException
MQEnvironment
.
queueManagerName
- the name of the queue manager.properties
- connection properties.
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, com.ibm.mq.MQConnectionManager connectionManager) throws MQException
queueManagerName
- the name of the queue manager.connectionManager
- the connection manager that will handle this connection.
MQException
- if there are connection problems.MQSimpleConnectionManager
public MQQueueManager(java.lang.String queueManagerName, int options, com.ibm.mq.MQConnectionManager connectionManager) throws MQException
queueManagerName
- the name of the queue manager.options
- binding options.
Possible values are:
MQC.MQCNO_FASTPATH_BINDING
MQC.MQCNO_STANDARD_BINDING
MQC.MQCNO_SHARED_BINDING
MQC.MQCNO_ISOLATED_BINDING
connectionManager
- the connection manager that will handle this connection.
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, java.util.Hashtable properties, com.ibm.mq.MQConnectionManager connectionManager) throws MQException
MQEnvironment
class with those in the given Hashtable.
queueManagerName
- the name of the queue manager.properties
- connection properties.connectionManager
- the connection manager that will handle this connection.
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, javax.resource.spi.ConnectionManager connectionManager) throws MQException
queueManagerName
- the name of the queue manager.connectionManager
- the connection manager which will handle this connection.
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, int options, javax.resource.spi.ConnectionManager connectionManager) throws MQException
queueManagerName
- the name of the queue manager.options
- binding options.
Possible values are:
MQC.MQCNO_FASTPATH_BINDING
MQC.MQCNO_STANDARD_BINDING
MQC.MQCNO_SHARED_BINDING
MQC.MQCNO_ISOLATED_BINDING
connectionManager
- the Connection manager that handles this connection
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, java.util.Hashtable properties, javax.resource.spi.ConnectionManager connectionManager) throws MQException
MQEnvironment
.
queueManagerName
- the name of the queue manager.properties
- connection properties.connectionManager
- the ConnectionManager which handles this connection.
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, java.net.URL url) throws MQException
MQEnvironment
class when opening a channel.
queueManagerName
- the queue manager that is used when selecting a channel definition.
This can be in of the following forms:
url
- the URL which specifies the channel definition file to be used
in connecting to the queue manager.
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, java.util.Hashtable properties, java.net.URL url) throws MQException
MQEnvironment
class when opening a channel.
Properties other than those defined by the client channel definition table may be supplied
with this constructor.
queueManagerName
- the queue manager that is used when selecting a channel definition.
This can be in of the following forms:
properties
- A hashtable of properties to be used to establish the connection with those
defined in the client channel definition that is actually used. Any properties that are not
valid for this type of connection will be be ignored.url
- the URL which specifies the channel definition file to be used
in connecting to the queue manager.
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, java.net.URL url, javax.resource.spi.ConnectionManager connectionManager) throws MQException
MQEnvironment
class when opening a channel.
The queue manager name parameter can be in one of the following forms:
queueManagerName
- the queue manager that is used when selecting a channel definition.
This can be in of the following forms:
url
- the URL which specifies the channel definition table to be used
in connecting to the queue manager.connectionManager
- the connection manager.
MQException
- if there are connection problems.public MQQueueManager(java.lang.String queueManagerName, java.net.URL url, com.ibm.mq.MQConnectionManager connectionManager) throws MQException
MQEnvironment
class when opening a channel.
queueManagerName
- the queue manager that is used when selecting a channel definition.
This can be in of the following forms:
url
- the URL which specifies the channel definition file to be used
in connecting to the queue manager.connectionManager
- the connection manager.
MQException
- if there are connection problems.Method Detail |
public java.sql.Connection getJDBCConnection(javax.sql.XADataSource xads) throws MQException, java.sql.SQLException, java.lang.Exception
xads
- A database-specific implementation of the XADataSource
interface that defines the details of the database to connect to.
See the documentation for your database to determine
how to create an appropriate XADataSource object to pass into this method.
MQException
- if there is a WebSphere MQ failure.
java.sql.SQLException
- if there are problems getting the Connection object.
java.lang.Exception
- thrown to avoid problems with the JVM verifier if you are not using
the JTA functionality.
The actual exception thrown is javax.transaction.xa.XAException,
which requires the jta.jar file to be added to the CLASSPATH for
programs that did not previously require it.public java.sql.Connection getJDBCConnection(javax.sql.XADataSource xads, java.lang.String userid, java.lang.String password) throws MQException, java.sql.SQLException, java.lang.Exception
begin()
.
xads
- database-specific implementation of the XADataSource
interface that defines the details of the database.
See the documentation for your database to determine
how to create an appropriate XADataSource object to pass into this method.userid
- the user ID for connecting to the database.password
- the password for connecting to the database.
MQException
- if there is a WebSphere MQ failure.
java.sql.SQLException
- if there are problems getting the Connection object.
java.lang.Exception
- thrown to avoid problems with the JVM verifier if you are not using the JTA functionality.
The actual exception thrown is javax.transaction.xa.XAException,
which requires the jta.jar file to be added to the CLASSPATH for
programs that did not previously require it.public boolean isConnected()
disconnect()
to disconnect from a queue manager.
public int getCharacterSet() throws MQException
MQException
- if you call this method after disconnecting
from the queue manager, indicating that the connection is no longer valid.public int getMaximumMessageLength() throws MQException
MQException
- if you call this method after disconnecting from the
queue manager, indicating that the connection is no longer valid.public int getCommandLevel() throws MQException
MQC.MQCMDL_LEVEL_1
and
MQC.MQCMDL_LEVEL_600
.
MQException
- if you call this method after disconnecting from the
queue manager to indicate that the connection is no longer valid.public java.lang.String getCommandInputQueueName() throws MQException
MQException
- if you call this method after disconnecting from the
queue manager, indicating that the connection is no longer valid.public int getMaximumPriority() throws MQException
MQException
- if you call this method after disconnecting from the
queue manager, indicating that the connection is no longer valid.public int getSyncpointAvailability() throws MQException
MQQueue.get()
and MQQueue.put()
methods.
MQC.MQSP_AVAILABLE
if syncpointing is available, or
MQC.MQSP_NOT_AVAILABLE
if not.
MQException
- if you call this method after disconnecting from the queue
manager to indicate that the connection is no longer valid.public boolean getDistributionListCapable()
public static java.util.Hashtable getProperties(java.lang.Object key, MQChannelHeader header, java.net.URL url) throws java.io.IOException, MQException
key
- the name of the channel.header
- helps to find the channel information in the table.url
- the URL of the channel definition table.
java.io.IOException
- if there are connection problems.
MQException
- if there are WebSphere MQ problems.public void disconnect() throws MQException
MQException
- if the MQ disconnect call fails.public void commit() throws MQException
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.
MQException
- if the call fails.backout()
public void backout() throws MQException
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.
MQException
- if the call fails.commit()
public void begin() throws MQException
MQException
- if the call failspublic void put(java.lang.String qName, java.lang.String qmName, MQMessage msg, MQPutMessageOptions pmo, java.lang.String altUserId) throws MQException
qName
- the name of the queue to which the message is put.qmName
- the name of the queue manager which holds the queue.msg
- the message to be sent.pmo
- the put message options to use.altUserId
- alternative user ID to use when putting the message.
MQException
- if the WebSphere MQ put call fails.public void put(java.lang.String qName, java.lang.String qmName, MQMessage msg, MQPutMessageOptions pmo) throws MQException
qName
- the name of the queue to which the message is put.qmName
- the name of the queue manager that holds the queue.msg
- the message to be sent.pmo
- the put message options to use.
MQException
- if the WebSphere MQ put call fails.public void put(java.lang.String qName, java.lang.String qmName, MQMessage msg) throws MQException
qName
- the name of the queue to which the message is put.qmName
- the name of the queue manager which holds the queue.msg
- the message to be sent.
MQException
- if the WebSphere MQ put call fails.public void put(java.lang.String qName, MQMessage msg, MQPutMessageOptions pmo) throws MQException
qName
- the name of the queue to which the message is put.msg
- the message to be sent.pmo
- the put message options to use.
MQException
- if the WebSphere MQ put call fails.public void put(java.lang.String qName, MQMessage msg) throws MQException
qName
- the name of the queue to which the message is put.msg
- the message to be sent.
MQException
- if the WebSphere MQ put call fails.public MQQueue accessQueue(java.lang.String queueName, int openOptions, java.lang.String queueManagerName, java.lang.String dynamicQueueName, java.lang.String alternateUserId) throws MQException
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.
queueName
- name of queue to open.openOptions
- options which control the opening of the queue.
As inquire and set options are automatically added to the options provided,
there is no need to specify these explicitly.
The valid options are:
MQC.MQOO_BROWSE
MQC.MQOO_INPUT_AS_Q_DEF
MQC.MQOO_INPUT_SHARED
MQC.MQOO_INPUT_EXCLUSIVE
MQC.MQOO_OUTPUT
MQC.MQOO_SAVE_ALL_CONTEXT
MQC.MQOO_PASS_IDENTITY_CONTEXT
MQC.MQOO_PASS_ALL_CONTEXT
MQC.MQOO_SET_IDENTITY_CONTEXT
MQC.MQOO_SET_ALL_CONTEXT
MQC.MQOO_ALTERNATE_USER_AUTHORITY
MQC.MQOO_FAIL_IF_QUIESCING
queueManagerName
- name of the queue manager on which the queue is defined.
A name which is blank, or which is null, denotes the queue manager to which this
object is connected.dynamicQueueName
- name of the dynamic queue to be created.
This parameter is ignored unless queueName specifies the name of a model queue.
If it does, this parameter specifies the name of the dynamic queue to be created.
A blank or null name is not valid if queueName specifies the name of a model queue.
If the last non-blank character in the name is an asterisk (*), the queue manager replaces
it with a string of characters which guarantees that the name generated for the queue
is unique at the local queue mananager.
Asterisk is only valid in positions 1 to 33 of the dynamicQueueName parameter.alternateUserId
- if MQC.MQOO_ALTERNATE_USER_AUTHORITY
is specified in the openOptions parameter this parameter
specifies the alternate user ID to be used to check the authorization for the open.
If MQC.MQOO_ALTERNATE_USER_AUTHORITY
is not
specified, this parameter can be left blank (or null).
MQException
- if the open fails.accessProcess(java.lang.String, int, java.lang.String, java.lang.String)
public MQQueue accessQueue(java.lang.String queueName, int openOptions) throws MQException
queueName
- the name of the queue to open.openOptions
- options which control the opening of the queue.
See accessQueue(String, int, String, String, String)
for more information.
MQException
- if the open fails.public MQProcess accessProcess(java.lang.String processName, int openOptions, java.lang.String queueManagerName, java.lang.String alternateUserId) throws MQException
processName
- name of the process to openopenOptions
- options which control the opening of the process.
As inquire is automatically added to the options specified there is no need to
specify it explicitly.
Valid options are:
If more than one option is required the values can be combined using either the '+' or
'|' operator.queueManagerName
- name of the queue manager on which the process is defined.
A name which is entirely blank or null denotes the queue manager to which this
object is connected.alternateUserId
- if MQC.MQOO_ALTERNATE_USER_AUTHORITY
is specified in the openOptions
parameter, this parameter specifies the alternative user ID to be used to
check the authorization for the open.
Otherwise this parameter can be blank or null.
MQException
- if the open fails.accessQueue(String, int, String, String, String)
public MQProcess accessProcess(java.lang.String processName, int openOptions) throws MQException
processName
- name of process to open.openOptions
- see openOptions
for details.
MQException
- if the open fails.accessProcess(String,int,String,String)
public MQDistributionList accessDistributionList(MQDistributionListItem[] items, int options, java.lang.String id) throws MQException
items
- the elements of the distribution list.options
- the open options for the distribution list.id
- the alternative user ID.
MQException
- if there is a problem opening the
distribution list.public MQDistributionList accessDistributionList(MQDistributionListItem[] items, int options) throws MQException
items
- the elements of the distribution list.options
- the open options for the distribution list.
MQException
- if there is a problem opening the
distribution list.public java.net.URL getCCDTURL()
|
(c) Copyright IBM Corp. 2005. All Rights Reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |