defining, MQEnvironment" />
Defining which connection type to use
The connection type is determined by the setting of the connection name, channel name, the
customization value
NMQ_MQ_LIB
and the property MQC.TRANSPORT_PROPERTY
.
We can specify the connection name as follows:
- Explicitly on an MQQueueManager constructor:
public MQQueueManager(String queueManagerName, MQLONG Options, string Channel, string ConnName)public MQQueueManager(String queueManagerName, string Channel, string ConnName)- By setting the properties MQC.HOST_NAME_PROPERTY and, optionally, MQC.PORT_PROPERTY in a hashtable entry on an MQQueueManager constructor:
public MQQueueManager(String queueManagerName, Hashtable properties)- As explicit MQEnvironment values
MQEnvironment.HostnameMQEnvironment.Port(optional).
- By setting the properties MQC.HOST_NAME_PROPERTY and, optionally, MQC.PORT_PROPERTY in the MQEnvironment.properties hashtable.
We can specify the channel name as follows:
- Explicitly on an MQQueueManager constructor:
public MQQueueManager(String queueManagerName, MQLONG Options, string Channel, string ConnName)public MQQueueManager(String queueManagerName, string Channel, string ConnName)- By setting the property MQC.CHANNEL_PROPERTY in a hashtable entry on an MQQueueManager constructor:
public MQQueueManager(String queueManagerName, Hashtable properties)- As an explicit MQEnvironment value
MQEnvironment.Channel- By setting the property MQC.CHANNEL_PROPERTY in the MQEnvironment.properties hashtable.
We can set the
customization value
NMQ_MQ_LIB to explicitly choose the connection type as shown in the following table
NMQ_MQ_LIB value Connection type mqic32.dll Connect as a non-XA client mqic32xa.dll Connect as an XA client mqm.dll Connect as a server managed
Connect as a
non-
XA managed client
If you choose a connection type which is unavailable in your environment, for example you specify mqic32xa.dll and don't have XA support, WebSphere MQ .NET throws an exception.
WebSphere MQ .NET chooses the connection type as follows:
- If MQC.TRANSPORT_PROPERTY is specified, it connects according to the value of MQC.TRANSPORT_PROPERTY.
- If a connection name has been specified without a channel name, or a channel name has been specified without a connection name, it throws an error.
- If both a connection name and a channel name have been specified:
- If NMQ_MQ_LIB is set to mqic32xa.dll, it connects as an XA client.
If NMQ_MQ_LIB is set to managed, it connects as a managed client.
- Otherwise it connects as a non-XA client.
- If NMQ_MQ_LIB is specified, it connects according to the value of NMQ_MQ_LIB.
- If a WebSphere MQ server is installed, it connects as a server.
If a WebSphere MQ client is installed, it connects as a non-XA client.
Otherwise, it connects as a managed client.
defconn