Class MQEnvironment
Note: All the methods and attributes of this class apply to the IBM MQ classes for Java client connections, but only enableTracing(), disableTracing(), properties, version_notice, userID, connOptions and connTag apply to bindings connections.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic URLA URL specifying the location of a Client Channel Definition Table (CCDT) to define the connection properties.static intThe CCSID used by the client.static StringThe name of the channel to connect to on the target queue manager.static ObjectThe receive exit used when receiving messages from a queue manager.static Stringstatic ObjectThe security exit used when connecting to a queue manager.static Stringstatic ObjectThe send exit used when sending messages to a queue manager.static Stringstatic intThe queue manager connection options.static byte[]The connection tag which allows users to serialize access to the resources they are using on a z/OS queue manager.static StringWhen defining Java security, send or receive exit as strings to be loaded by the class loader, the path that has the class or jar that contains the class has to be known to the loader.static CollectionThe list of supported compressors for header compression.static StringThe TCP/IP hostname of the machine on which the IBM MQ server resides.static StringThe local address, including a range of ports, used when connecting to an IBM MQ queue manager through a firewall.static CollectionThe list of supported compressors for message compression.static StringThe password used to verify the identity of the IBM MQ Client.static intThe port to be used.static HashtableA Hashtable which defines the IBM MQ environment.static MQReceiveExitDeprecated.The receive exit used when receiving messages from a queue manager.static StringDeprecated.static MQSecurityExitDeprecated.The security exit used when connecting to a queue manager.static StringDeprecated.static MQSendExitDeprecated.The send exit used when sending messages to a queue manager.static StringDeprecated.static intThe number of conversations per connection.static CollectionCollection of SSL CertStores.static StringThe name of the Cipher Suite to be used by SSL.static booleanWhen this is set to true, the only Cipher Suites that can be used on an SSL connection from this client process are those which are FIPS-enabled.static StringThe Distinguished Name (DN) of the queue manager to be used by SSL.static intThe total number of unencrypted bytes that are sent and received by the initiating channel MCA before the secret key is reset.static ObjectThe factory to use when connecting with SSL encryption.static StringThe ID used to identify the IBM MQ client.static final StringThe current version of the IBM MQ Java Classes.Fields inherited from class com.ibm.mq.jmqi.JmqiObject
COMP_JM, COMP_JN, COMP_JO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MQPoolTokenConstructs an MQPoolToken and adds it to the set of tokens.static voidAdds a given MQPoolToken to the connection pool.static voidThis method turns off the IBM MQ Client for Java trace facility.static voidenableTracing(int level) static voidenableTracing(int level, OutputStream stream) Turns on tracing to console & (default) filestatic com.ibm.mq.MQConnectionManagerGets the default ConnectionManager.static MQQueueManagergetQueueManagerReference(int scope) Deprecated.This method and MQC.MQ_QMGR_ASSOCIATION_PROPERTY are deprecated, as they generally provide no particular value.static MQQueueManagergetQueueManagerReference(int scope, Object context) Deprecated.This method and MQC.MQ_QMGR_ASSOCIATION_PROPERTY are deprecated, as they generally provide no particular value.static final StringGets the current version of the IBM MQ Java Classes.static voidRemoves a token from the connection pool.static voidsetDefaultConnectionManager(com.ibm.mq.MQConnectionManager mqCxMan) Sets the default MQConnectionManager, and empties the set of MQPoolTokens.Methods inherited from class com.ibm.mq.jmqi.JmqiObject
getJmqiEnvironment
-
Field Details
-
version_notice
-
securityExit
Deprecated.The security exit used when connecting to a queue manager. It allows you to customise the security flows that occur when an attempt is made to connect to a queue manager.If you want to provide your own security exit, define a class that implements the MQSecurityExit interface and assign securityExit to an instance of that class.
If you set this field to null no security exit is called.
-
securityExitUserData
Deprecated. -
channelSecurityExit
The security exit used when connecting to a queue manager. It allows you to customise the security flows that occur when an attempt is made to connect to a queue manager.If you want to provide your own security exit, define a class that implements either:- MQSecurityExit, WMQSecurityExit interface or String and assign securityExit to an instance of that class or the class definition to the string.
If you set this field to null no security exit is called.
-
channelSecurityExitUserData
-
sendExit
Deprecated.The send exit used when sending messages to a queue manager. It allows you to examine, and possibly alter, data and is normally used in conjunction with a corresponding receive exit at the queue manager.If you want to provide your own send exit, define a class that implements the MQSendExit interface, and assign sendExit to an instance of that class.
If you set this field to null no send exit is called.
-
sendExitUserData
Deprecated. -
channelSendExit
The send exit used when sending messages to a queue manager. It allows you to examine, and possibly alter, data and is normally used in conjunction with a corresponding receive exit at the queue manager.If you want to provide your own send exit, define a class that implements either:- MQSendExit, WMQSendExit interface or List or String and assign sendExit to an instance of that class or the class definition to the string.
If you set this field to null no send exit is called.
-
channelSendExitUserData
-
receiveExit
Deprecated.The receive exit used when receiving messages from a queue manager. It allows you to examine, and possibly alter, data and is normally used in conjunction with a corresponding send exit at the queue manager.If you want to provide your own receive exit, define a class that implements the MQReceiveExit interface, and assign receiveExit to an instance of that class.
If you set this field to null no receive exit is called.
-
receiveExitUserData
Deprecated. -
channelReceiveExit
The receive exit used when receiving messages from a queue manager. It allows you to examine, and possibly alter, data and is normally used in conjunction with a corresponding send exit at the queue manager.If you want to provide your own send exit, define a class that implements either:- MQReceiveExit, WMQReceiveExit interface or List ro String and assign receiveExit to an instance of that class or the class definition to the string.
If you set this field to null no receive exit is called.
-
channelReceiveExitUserData
-
exitClasspath
When defining Java security, send or receive exit as strings to be loaded by the class loader, the path that has the class or jar that contains the class has to be known to the loader. The loader uses the system property com.ibm.mq.exitClasspath to find the classes. This property can be used by the client application to add the path of the class that will be dynamically loaded. -
hostname
The TCP/IP hostname of the machine on which the IBM MQ server resides. If the hostname is not set, and no overriding properties are set, bindings mode is used to connect to the local queue manager. -
port
public static int portThe port to be used. This is the port on which IBM MQ listens for connection requests.The default value is 1414.
-
channel
The name of the channel to connect to on the target queue manager. It does not apply when connecting directly to IBM MQ in bindings mode. You must set this field, or the corresponding property, before constructing an MQQueueManager instance for use in client mode. -
userID
The ID used to identify the IBM MQ client. It is equivalent to the IBM MQ environment variable MQ_USER_ID.
The default value is null.
If no security exit is defined for this client and userID is set to null or the empty string "" the IBM MQ classes for Java will query the Java System Property "user.name" and transmit this to the server.
If no security exit is defined for this client and userID has been set to a value other than null and the empty string "", then this value will be transmitted to the server.
If a security exit is defined for this client, then it is the responsibility of the exit to apply any application specific security logic. The value of userID is not made available to the exit and is not transmitted to the server.
-
password
The password used to verify the identity of the IBM MQ Client. It is equivalent to the MQ environment variable MQ_PASSWORD.If a security exit is not defined for this client, the value of password is transmitted to the server and is available to the server security exit when it is invoked.
The default value is null.
Note that the password must be representable in the coded character set of the queue manager to which the client is connecting, which may differ from the coded character set of the client. The connection will fail if the password cannot be converted between the two character sets.
-
ccdtUrlProperty
A URL specifying the location of a Client Channel Definition Table (CCDT) to define the connection properties. -
CCSID
public static int CCSIDThe CCSID used by the client. It does not apply when connecting directly to IBM MQ in bindings mode.Changing this value affects the way that the queue manager you connect to translates information in the IBM MQ headers. All data in IBM MQ headers is drawn from the invariant part of the ASCII codeset, except for the data in the
MQMessage.applicationIdDataandMQMessage.putApplicationNamefields.If you avoid using characters from the variant part of the ASCII codeset for these two fields, then the CCSID can be changed from 819 to any other ASCII codeset.
If you change the client CCSID to be the same as that of the queue manager to which you are connecting, you gain a performance benefit at the queue manager because it does not attempt to translate the message headers. For the reasons outlined above, this only applies to ASCII codesets - you must not set the CCSID to an EBCDIC-based value when communicating with a queue manager using EBCDIC.
The default value is 819.
- See Also:
-
hdrCompList
The list of supported compressors for header compression. Possible values are: -
msgCompList
The list of supported compressors for message compression. Possible values are: -
sslCipherSuite
The name of the Cipher Suite to be used by SSL. SSL is only valid for a client connection and is triggered by setting sslCipherSuite. If sslCipherSuite is not set, all of the other values are irrelevant and a standard non-SSL connection is used to connect to the server.- See Also:
-
sslPeerName
The Distinguished Name (DN) of the queue manager to be used by SSL. The peer name is set to indicate that connections should only be allowed where the server is successfully authenticated as a specific DN.- See Also:
-
sslCertStores
Collection of SSL CertStores. The collection of CertStores (J2SE 1.4 only) is used to enable IBM MQ Java clients to check certificates for revocation in a Certificate Revocation List (CRL).- See Also:
-
sslSocketFactory
The factory to use when connecting with SSL encryption. If sslCipherSuite is set, this variable can be used to customize all aspects of the SSL connection.For more information on constructing and customizing SSLSocketFactory instances, refer to your JSSE provider.
If set to null (default) and SSL encryption is requested, the default SSLSocketFactory is used.
This variable is ignored if
sslCipherSuiteis null. -
sslResetCount
public static int sslResetCountThe total number of unencrypted bytes that are sent and received by the initiating channel MCA before the secret key is reset. The number of bytes includes control information sent by the message channel agent. A value of 0 disables secret key reset from occurring. -
sslFipsRequired
public static boolean sslFipsRequiredWhen this is set to true, the only Cipher Suites that can be used on an SSL connection from this client process are those which are FIPS-enabled. In this case, if and a customized sslSocketFactory has been specified the customized sslSocketFactory will not be used, as it cannot be guaranteed that the sslSocketFactory is FIPS compliant. -
localAddressSetting
The local address, including a range of ports, used when connecting to an IBM MQ queue manager through a firewall. The format is[ip-addr][(low-port[,high-port])].Here are some examples:
- 9.20.4.98
- The channel binds to address 9.20.4.98 locally
- 9.20.4.98(1000)
- The channel binds to address 9.20.4.98 locally and uses port 1000
- 9.20.4.98(1000,2000)
- The channel binds to address 9.20.4.98 locally and uses a port in the range 1000 to 2000
- (1000)
- The channel binds to port 1000 locally
- (1000,2000)
- The channel binds to a port in the range 1000 to 2000 locally
You can specify a host name instead of an IP address. The variable is initialized from system property com.ibm.mq.localAddress when you start the JVM. The default value is null.
-
connTag
public static byte[] connTagThe connection tag which allows users to serialize access to the resources they are using on a z/OS queue manager. The connTag String is truncated to 128 bytes. connTag is ignored ifconnOptionsis not set. -
connOptions
public static int connOptionsThe queue manager connection options. Possible values are:MQConstants.MQCNO_STANDARD_BINDINGMQConstants.MQCNO_FASTPATH_BINDINGMQConstants.MQCNO_ISOLATED_BINDINGMQConstants.MQCNO_SHARED_BINDINGMQConstants.MQCNO_RESTRICT_CONN_TAG_Q_MGRMQConstants.MQCNO_RESTRICT_CONN_TAG_QSGMQConstants.MQCNO_SERIALIZE_CONN_TAG_Q_MGRMQConstants.MQCNO_SERIALIZE_CONN_TAG_QSG
-
sharingConversations
public static int sharingConversationsThe number of conversations per connection. Allows user to turn multiplexing ON or OFF. A value of 0 turns multiplexing off. -
properties
A Hashtable which defines the IBM MQ environment.This Hashtable allows you to set environment properties as key/value pairs rather than as individual variables.
The properties can also be passed as a Hashtable in a parameter on the
MQQueueManagerconstructor. Properties passed on the constructor take precedence over values set with this properties variable, but they are otherwise interchangeable. The order of precedence of finding properties is:- properties parameter on MQQueueManager constructor
- MQEnvironment.properties
- Other MQEnvironment variables
- Constant default values
The property key names are:
MQC.CCDT_URL_PROPERTY- overrides
ccdtUrlProperty. MQConstants.CCSID_PROPERTY- overrides
CCSID. MQConstants.CHANNEL_PROPERTY- overrides
channel. MQConstants.CONNECT_OPTIONS_PROPERTY- overrides
connOptions. MQConstants.CONNTAG_PROPERTY- overrides
connTag. MQC.HEADER_COMPRESSION_PROPERTY- overrides
hdrCompList. MQC.MESSAGE_COMPRESSION_PROPERTY- overrides
msgCompList. MQConstants.HOST_NAME_PROPERTY- overrides
hostname. MQConstants.LOCAL_ADDRESS_PROPERTY- overrides
localAddressSetting. MQConstants.PASSWORD_PROPERTY- overrides
password. MQConstants.PORT_PROPERTY- overrides
port. - The deprecated property MQConstants.RECEIVE_EXIT_PROPERTY
- overrides
receiveExit. - The deprecated property MQConstants.SECURITY_EXIT_PROPERTY
- overrides
securityExit. - The deprecated property MQConstants.SEND_EXIT_PROPERTY
- overrides
sendExit. MQConstants.SSL_CERT_STORE_PROPERTY- overrides
sslCertStores. MQConstants.SSL_CIPHER_SUITE_PROPERTY- overrides
sslCipherSuite. MQConstants.SSL_FIPS_REQUIRED- overrides
sslFipsRequired. MQConstants.SSL_RESET_COUNT_PROPERTY.- overrides
sslResetCount. MQConstants.SSL_PEER_NAME_PROPERTY.- overrides
sslPeerName. MQConstants.SSL_SOCKET_FACTORY_PROPERTY- overrides
sslSocketFactory. MQConstants.TRANSPORT_PROPERTY- forces
MQConstants.TRANSPORT_MQSERIES_BINDINGSorMQConstants.TRANSPORT_MQSERIES_CLIENT. MQConstants.USER_ID_PROPERTY- overrides
userID. MQC.SHARING_CONVERSATIONS_PROPERTY- overrides
sharingConversations.
-
-
Constructor Details
-
MQEnvironment
public MQEnvironment()Constructor
-
-
Method Details
-
getVersionNotice
Gets the current version of the IBM MQ Java Classes.- Returns:
- the version.
-
enableTracing
public static void enableTracing(int level) - Parameters:
level- ignored at this version
-
enableTracing
Turns on tracing to console & (default) file- Parameters:
level- ignored at this versionstream- ignored (unfortunately) at present
-
disableTracing
public static void disableTracing()This method turns off the IBM MQ Client for Java trace facility. -
setDefaultConnectionManager
public static void setDefaultConnectionManager(com.ibm.mq.MQConnectionManager mqCxMan) Sets the default MQConnectionManager, and empties the set of MQPoolTokens. The default ConnectionManager is used when no ConnectionManager is specified on the MQQueueManager constructor.- Parameters:
mqCxMan- the supplied MQConnectionManager.
-
getDefaultConnectionManager
public static com.ibm.mq.MQConnectionManager getDefaultConnectionManager()Gets the default ConnectionManager.- Returns:
- the ConnectionManager, or null if the default connection manager is an MQConnectionManager rather than a ConnectionManager.
-
addConnectionPoolToken
Adds a given MQPoolToken to the connection pool. A default ConnectionManager can use this as a hint; typically, it is enabled only while there is at least one token in the connection pool.- Parameters:
token- the token to be added.
-
addConnectionPoolToken
Constructs an MQPoolToken and adds it to the set of tokens. The token is returned to the application to be passed later into theremoveConnectionPoolToken()method.- Returns:
- the token that has been added.
-
removeConnectionPoolToken
Removes a token from the connection pool.- Parameters:
token- the token to be removed.
-
getQueueManagerReference
Deprecated.This method and MQC.MQ_QMGR_ASSOCIATION_PROPERTY are deprecated, as they generally provide no particular value.Returns anMQQueueManagerobject reference if one is available within the specified scope. The scope must be one of MQC.ASSOCIATE_ALL or MQC.ASSOCIATE_THREAD}, and a queue manager must already have been created with the MQC.MQ_QMGR_ASSOCIATION_PROPERTY property set to the scope requested.If no queue manager has been created within the specified scope, or if MQC.ASSOCIATE_NONE is specified, this method will return null.
A call to this method is the same as calling
MQEnvironment.getQueueManagerReference(int, Object)with a null Object.- Parameters:
scope- the association scope- Returns:
- MQQueueManager, or null if no reference is available.
- See Also:
-
getQueueManagerReference
Deprecated.This method and MQC.MQ_QMGR_ASSOCIATION_PROPERTY are deprecated, as they generally provide no particular value.Returns anMQQueueManagerobject reference if one is available within the specified scope. The scope must be one ofMQC.ASSOCIATE_ALLorMQC.ASSOCIATE_THREAD, and a queue manager must already have been created withMQC.MQ_QMGR_ASSOCIATION_PROPERTYset to the scope requested. The supplied Object gives information necessary to identify the MQQueueManager within the scope; for MQC.ASSOCIATE_ALL and MQC.ASSOCIATE_THREAD this Object must be a String containing the name of the queue manager.If no queue manager identified by the supplied Object has been created within the specified scope, or if
MQC.ASSOCIATE_NONEis specified, this method will return null.An MQQueueManager object returned by this method will refer to the same underlying HConn as the MQQueueManager created with MQConstants.MQ_QMGR_ASSOCIATION_PROPERTY set, and both will therefore share the same transaction context. If an attempt is made to create a second MQQueueManager object on the same context to a different queue manager, then a separate HConn will be made, and the first and second object will have independent transaction contexts. These contexts will extend to IBM MQ coordinated JDBC transactions by using
MQQueueManager.getJDBCConnection(XADataSource)on the appropriate queue manager.- Parameters:
scope- the association scopecontext- an object containing context. Currently this must be a String specifying an IBM MQ queue manager name- Returns:
- MQQueueManager, or null if no reference is available.
-