MQQueueManager.NET class
Use MQQueueManager to connect to a queue manager and access queue manager objects. It also controls transactions. The MQQueueManager constructor creates either a client or server connection.
Class
System.Object | └─ IBM.WMQ.MQBase | └─ IBM.WMQ.MQBaseObject | └─ IBM.WMQ.ManagedObject | └─ IBM.WMQ.MQQueueManagerpublic class IBM.WMQ.MQQueueManager extends IBM.WMQ.MQManagedObject;
Properties
Test for MQException being thrown when getting properties.
- public int AccountingConnOverride {get;}
- Whether applications can override the setting of the MQI accounting and queue accounting values.
- public int AccountingInterval {get;}
- How long before intermediate accounting records are written (in seconds).
- public int ActivityRecording {get;}
- Controls the generation of activity reports.
- public int AdoptNewMCACheck {get;}
- Specifies which elements are checked to determine whether the MCA is adopted when a new inbound channel is detected. To be adopted, the MCA name must match the name of an active MCA.
- public int AdoptNewMCAInterval {get;}
- The amount of time, in seconds, that the new channel waits for the orphaned channel to end.
- public int AdoptNewMCAType {get;}
- Whether an orphaned MCA instance is to be adopted (restarted) when a new inbound channel request is detected matching the AdoptNewMCACheck value.
- public int BridgeEvent {get;}
- Whether IMS bridge events are generated.
- public int ChannelEvent {get;}
- Whether channel events are generated.
- public int ChannelInitiatorControl {get;}
- Whether the channel initiator starts automatically when the queue manager starts.
- public int ChannelInitiatorAdapters {get;}
- The number of adapter subtasks to process IBM MQ calls.
- public int ChannelInitiatorDispatchers {get;}
- The number of dispatchers to use for the channel initiator.
- public int ChannelInitiatorTraceAutoStart {get;}
- Specifies whether the channel initiator trace starts automatically.
- public int ChannelInitiatorTraceTableSize {get;}
- The size, in megabytes, of the trace data space of a channel initiator.
- public int ChannelMonitoring {get;}
- Whether channel monitoring is used.
- public int ChannelStatistics {get;}
- Controls the collection of statistics data for channels.
- public int CharacterSet {get;}
- Returns the coded character set identifier (CCSID) of the queue manager. CharacterSet is used by the queue manager for all character string fields in the application programming interface.
- public int ClusterSenderMonitoring {get;}
- Controls the collection of online monitoring data for automatically defined cluster sender channels.
- public int ClusterSenderStatistics {get;}
- Controls the collection of statistics data for automatically defined cluster sender channels.
- public int ClusterWorkLoadMRU {get;}
- The maximum number of outbound cluster channels.
- public int ClusterWorkLoadUseQ {get;}
- The default value of the MQQueue property, ClusterWorkLoadUseQ, if it specifies a value of QMGR.
- public int CommandEvent {get;}
- Specifies whether command events are generated.
- public string CommandInputQueueName {get;}
- Returns the name of the command input queue defined on the queue manager. Applications can send commands to this queue, if authorized to do so.
- public int CommandLevel {get;}
- Indicates the function level of the queue manager. The set of functions that correspond to a particular function level depends on the platform. On a particular platform, we can rely on every queue manager supporting the functions at the lowest functional level common to all the queue managers.
- public int CommandLevel {get;}
- Whether the command server starts automatically when the queue manager starts.
- public string DNSGroup {get;}
- No longer used.
- public int DNSWLM {get;}
- No longer used.
- public int IPAddressVersion {get;}
- Which IP protocol (IPv4 or IPv6) to use for a channel connection.
- public boolean IsConnected {get;}
- Returns the value of the isConnected.
- public int KeepAlive {get;}
- Specifies whether the TCP KEEPALIVE facility is to be used to check that the other end of the connection is still available. If it is unavailable, the channel is closed.
- public int ListenerTimer {get;}
- The time interval, in seconds, between attempts by IBM MQ to restart the listener after an APPC or TCP/IP failure.
- public int LoggerEvent {get;}
- Whether logger events are generated.
- public string LU62ARMSuffix {get;}
- The suffix of the APPCPM member of SYS1.PARMLIB. This suffix nominates the LUADD for this channel initiator. When automatic restart manager (ARM) restarts the channel initiator, the z/OS command SET APPC=xx is issued.
- public string LUGroupName {get; z/os}
- The generic LU name to be used by the LU 6.2 listener that handles inbound transmissions for the queue sharing group.
- public string LUName {get;}
- The name of the LU to use for outbound LU 6.2 transmissions.
- public int MaximumActiveChannels {get;}
- The maximum number of channels that can be active at any time.
- public int MaximumCurrentChannels {get;}
- The maximum number of channels that can be current at any time (including server-connection channels with connected clients).
- public int MaximumLU62Channels {get;}
- The maximum number of channels that can be current, or clients that can be connected, that use the LU 6.2 transmission protocol.
- public int MaximumMessageLength {get;}
- Returns the maximum length of a message (in bytes) that can be handled by the queue manager. No queue can be defined with a maximum message length greater than MaximumMessageLength.
- public int MaximumPriority {get;}
- Returns the maximum message priority supported by the queue manager. Priorities range from zero (lowest) to this value. Throws MQException if you call this method after disconnecting from the queue manager.
- public int MaximumTCPChannels {get;}
- The maximum number of channels that can be current, or clients that can be connected, that use the TCP/IP transmission protocol.
- public int MQIAccounting {get;}
- Controls the collection of accounting information for MQI data.
- public int MQIStatistics {get;}
- Controls the collection of statistics monitoring information for the queue manager.
- public int OutboundPortMax {get;}
- The maximum value in the range of port numbers to be used when binding outgoing channels.
- public int OutboundPortMin {get;}
- The minimum value in the range of port numbers to be used when binding outgoing channels.
- public int QueueAccounting {get;}
- Whether class 3 accounting (thread-level and queue-level accounting) data is to be used for all queues.
- public int QueueMonitoring {get;}
- Controls the collection of online monitoring data for queues.
- public int QueueStatistics {get;}
- Controls the collection of statistics data for queues.
- public int ReceiveTimeout {get;}
- The length of time that a TCP/IP channel waits to receive data, including heartbeats, from its partner before returning to the inactive state.
- public int ReceiveTimeoutMin {get;}
- The minimum length of time that a TCP/IP channel waits to receive data, including heartbeats, from its partner before returning to an inactive state.
- public int ReceiveTimeoutType {get;}
- The qualifier to apply to the value in ReceiveTimeout.
- public int SharedQueueQueueManagerName {get;}
- Specifies how to deliver messages to a shared queue. If the put specifies a different queue manager from the same queue sharing group as the target queue manager, the message is delivered in two ways:
- MQC.MQSQQM_USE
- Messages are delivered to the object queue manager before being put on the shared queue.
- MQCMQSQQM_IGNORE
- Messages are put directly on the shared queue.
- public int SSLEvent {get;}
- Whether TLS events are generated.
- public int SSLFips {get;}
- Whether only FIPS-certified algorithms are to be used if cryptography is performed in IBM MQ, rather than cryptographic hardware.
- public int SSLKeyResetCount {get;}
- Indicates the number of unencrypted bytes sent and received within a TLS conversation before the secret key is renegotiated.
- public int ClusterSenderStatistics {get;}
- Specifies the interval, in minutes, between consecutive gatherings of statistics.
- public int SyncpointAvailability {get;}
- Indicates whether the queue manager supports units of work and sync points with the MQQueue.get and MQQueue.put methods.
- public string TCPName {get;}
- The name of either the only, or default, TCP/IP system to be used, depending on the value of TCPStackType.
- public int TCPStackType {get;}
- Specifies whether the channel initiator uses only the TCP/IP address space specified in TCPName. Alternatively, the channel initiator can bind to any TCP/IP address.
- public int TraceRouteRecording {get;}
- Controls the recording of route tracing information.
Methods
- public MQProcess AccessProcess(string processName, int openOptions);
- public MQProcess AccessProcess(string processName, int openOptions, string queueManagerName, string alternateUserId);
-
Throws MQException.
Access an IBM MQ process on this queue manager to inquire on process attributes.
- processName
- The name of the process to open.
- openOptions
- Options that control the opening of the process. The valid options that can be added, or combined using a bitwise OR, are:
- MQC.MQOO_FAIL_IF_QUIESCING
- MQC.MQOO_INQUIRE
- MQC.MQOO_SET
- MQC.MQOO_ALTERNATE_USER_AUTHORITY
- queueManagerName
- The name of the queue manager on which the process is defined. We can leave a blank or null queue manager name if the queue manager is the same as the one the process is accessing.
- alternateUserId
-
If MQC.MQOO_ALTERNATE_USER_AUTHORITY is specified in the openOptions parameter, alternateUserId specifies the alternative user ID used to check the authorization for the action. If MQOO_ALTERNATE_USER_AUTHORITY is not specified, alternateUserId can be blank or null.
Default user authority is used for connection to the queue manager if MQC.MQOO_ALTERNATE_USER_AUTHORITY is not specified.
- public MQQueue AccessQueue(string queueName, int openOptions);
- public MQQueue AccessQueue(string queueName, int openOptions, string queueManagerName, string dynamicQueueName, string alternateUserId);
-
Throws MQException.
Accesses a queue on this queue manager.
We can 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, a dynamic local queue is created. Query the name attribute of the resultant MQQueue object to find out the name of the dynamic queue.
- queueName
- Name of queue to open.
- openOptions
- Options that control the opening of the queue.
- MQC.MQOO_ALTERNATE_USER_AUTHORITY
- Validate with the specified user identifier.
- MQC.MQOO_BIND_AS_QDEF
- Use default binding for queue.
- MQC.MQOO_BIND_NOT_FIXED
- Do not bind to a specific destination.
- MQC.MQOO_BIND_ON_OPEN
- Bind handle to destination when queue is opened.
- MQC.MQOO_BROWSE
- Open to browse message.
- MQC.MQOO_FAIL_IF_QUIESCING
- Fail if the queue manager is quiescing.
- MQC.MQOO_INPUT_AS_Q_DEF
- Open to get messages using queue-defined default.
- MQC.MQOO_INPUT_SHARED
- Open to get messages with shared access.
- MQC.MQOO_INPUT_EXCLUSIVE
- Open to get messages with exclusive access.
- MQC.MQOO_INQUIRE
- Open for inquiry - required if we want to query properties.
- MQC.MQOO_OUTPUT
- Open to put messages.
- MQC.MQOO_PASS_ALL_CONTEXT
- Allow all context to be passed.
- MQC.MQOO_PASS_IDENTITY_CONTEXT
- Allow identity context to be passed.
- MQC.MQOO_SAVE_ALL_CONTEXT
- Save context when message retrieved.
- MQC.MQOO_SET
- Open to set attributes - required if we want to set properties.
- MQC.MQOO_SET_ALL_CONTEXT
- Allows all context to be set.
- MQC.MQOO_SET_IDENTITY_CONTEXT
- Allows identity context to be set.
- queueManagerName
- Name of the queue manager on which the queue is defined. A name that is entirely blank or null denotes the queue manager to which the MQQueueManager object is connected.
- dynamicQueueName
- dynamicQueueName is ignored unless queueName specifies the name of a model queue. If it does, dynamicQueueName 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 nonblank character in the name is an asterisk, *, the queue manager replaces the asterisk with a string of characters. The characters guarantee that the name generated for the queue is unique on this queue manager.
- alternateUserId
- If MQC.MQOO_ALTERNATE_USER_AUTHORITY is specified in the openOptions parameter, alternateUserId specifies the alternate user identifier that is used to check the authorization for the open. If MQC.MQOO_ALTERNATE_USER_AUTHORITY is not specified, alternateUserId can be left blank, or null.
- public MQTopic AccessTopic( MQDestination destination, string topicName, string topicObject, int options);
- public MQTopic AccessTopic( MQDestination destination, string topicName, string topicObject, int options, string alternateUserId);
- public MQTopic AccessTopic( MQDestination destination, string topicName, string topicObject, int options, string alternateUserId, string subscriptionName);
- public MQTopic AccessTopic( MQDestination destination, string topicName, string topicObject, int options, string alternateUserId, string subscriptionName, System.Collections.Hashtable properties);
- public MQTopic AccessTopic(string topicName, string topicObject, int openAs, int options);
- public MQTopic AccessTopic(string topicName, string topicObject, int openAs, int options, string alternateUserId);
- public MQTopic AccessTopic(string topicName, string topicObject, int options, string alternateUserId, string subscriptionName);
- public MQTopic AccessTopic(string topicName, string topicObject, int options, string alternateUserId, string subscriptionName, System.Collections.Hashtable properties);
-
Access a topic on this queue manager.
MQTopic objects are closely related to administrative topic objects, which are sometimes called topic objects. On input, topicObject points to an administrative topic object. The MQTopic constructor obtains a topic string from the topic object and combines it with topicName to create a topic name. Either or both topicObject or topicName can be null. The topic name is matched to the topic tree, and the name of the closest matching administrative topic object is returned in topicObject.
The topics that are associated with the MQTopic object are the result of combining two topic strings. The first topic string is defined by the administrative topic object identified by topicObject. The second topic string is topicString. The resulting topic string associated with the MQTopic object can identify multiple topics by including wildcards.
Depending on whether the topic is opened for publishing or subscribing, we can use the MQTopic.Put methods to publish on topics, or MQTopic.Get methods to receive publications on topics. To publish and subscribe to the same topic, we must access the topic twice, once for publish and once for subscribe.
If you create an MQTopic object for subscription, without providing an MQDestination object, a managed subscription is assumed. If you pass a queue as an MQDestination object, an unmanaged subscription is assumed. We must ensure the subscription options you set are consistent with the subscription being managed or unmanaged.
- destination
- destination is an MQQueue instance. By providing destination, MQTopic is opened as an unmanaged subscription. Publications on the topic are delivered to the queue accessed as destination.
- topicName
- A topic string that is the second part of the topic name. topicName is concatenated with the topic string defined in the topicObject administrative topic object. We can set topicName to null, in which case the topic name is defined by the topic string in topicObject.
- topicObject
- On input, topicObject is the name of the topic object that contains the topic string that forms the first part of the topic name. The topic string in topicObject is concatenated with topicName. The rules for constructing topic strings are defined in Combining topic strings.
- openAs
- Access the topic to publish or subscribe. The parameter can contain only one of these options:
- MQC.MQTOPIC_OPEN_AS_SUBSCRIPTION
- MQC.MQTOPIC_OPEN_AS_PUBLICATION
- options
-
Combine the options that control the opening of the topic for either publication or subscription. Use MQC.MQSO_* constants to access a topic for subscription and MQC.MQOO_* constants to access a topic for publication.
If more than one option is required, add the values together, or combine the option values using the bitwise OR operator.
- alternateUserId
- Specify the alternate user ID that is used to check for the required authorization to finish the operation. We must specify alternateUserId, if either MQC.MQOO_ALTERNATE_USER_AUTHORITY or MQC.MQSO_ALTERNATE_USER_AUTHORITY is set in the options parameter.
- subscriptionName
- subscriptionName is required if the options MQC.MQSO_DURABLE or MQC.MQSO_ALTER are provided. In both cases, MQTopic is implicitly opened for subscription. An exception is thrown if the MQC.MQSO_DURABLE is set, and the subscription exists, or if MQC.MQSO_ALTER is set, and the subscription does not exist.
- properties
- Set any of the special subscription properties listed using a hash table. Specified entries in the hash table are updated with output values. Entries are not added to the hash table to report output values.
- MQC.MQSUB_PROP_ALTERNATE_SECURITY_ID
- MQC.MQSUB_PROP_SUBSCRIPTION_EXPIRY
- MQC.MQSUB_PROP_SUBSCRIPTION_USER_DATA
- MQC.MQSUB_PROP_SUBSCRIPTION_CORRELATION_ID
- MQC.MQSUB_PROP_PUBLICATION_PRIORITY
- MQC.MQSUB_PROP_PUBLICATION_ACCOUNTING_TOKEN
- MQC.MQSUB_PROP_PUBLICATION_APPLICATIONID_DATA
- public MQAsyncStatus GetAsyncStatus();
-
Throws MQException
Returns an MQAsyncStatus object, which represents the asynchronous activity for the queue manager connection.
- public void Backout();
-
Throws MQException.
Backout any messages that were read or written within sync point since the last sync point.
Messages that were written with the MQC.MQPMO_SYNCPOINT flag set are removed from queues. Messages read with the MQC.MQGMO_SYNCPOINT flag are reinstated on the queues they came from. If the messages are persistent, the changes are logged.
For reconnectable clients, the MQRC_NONE reason code is returned to a client after reconnection is successful.
- public void Begin();
-
Throws MQException.
Begin is supported only in server bindings mode. It starts a global unit of work.
- public void Commit();
-
Throws MQException.
Commit any messages that were read or written within sync point since the last sync point.
Messages written with the MQC.MQPMO_SYNCPOINT flag set are made available to other applications. Messages retrieved with the MQC.MQGMO_SYNCPOINT flag set are deleted. If the messages are persistent, the changes are logged.
The following reason codes are returned to a reconnectable client:- MQRC_CALL_INTERRUPTED if connection is lost while carrying out the commit call.
- MQRC_BACKED_OUT if the commit call is issued after reconnection.
- Disconnect();
-
Throws MQException.
Close the connection to the queue manager. All objects accessed on this queue manager are not longer accessible to this application. To reaccess the objects, create a MQQueueManager object.
Generally, any work performed as part of a unit of work is committed. However, if the unit of work is managed by .NET, the unit of work might be rolled back.
- public void Put(int type, string destinationName, MQMessage message);
- public void Put(int type, string destinationName, MQMessage message MQPutMessageOptions putMessageOptions);
- public void Put(int type, string destinationName, string queueManagerName, string topicString, MQMessage message);
- public void Put(string queueName, MQMessage message);
- public void Put(string queueName, MQMessage message, MQPutMessageOptions putMessageOptions);
- public void Put(string queueName, string queueManagerName, MQMessage message);
- public void Put(string queueName, string queueManagerName, MQMessage message, MQPutMessageOptions putMessageOptions);
- public void Put(string queueName, string queueManagerName, MQMessage message, MQPutMessageOptions putMessageOptions, string alternateUserId);
-
Throws MQException.
Places a single message onto a queue or topic without creating an MQQueue or MQTopic object first.
- queueName
- The name of the queue onto which to place the message.
- destinationName
- The name of a destination object. It is either a queue or a topic depending on the value of type.
- type
- The type of destination object. We must not combine the options.
- MQC.MQOT_Q
- Queue
- MQC.MQOT_TOPIC
- Topic
- queueManagerName
-
The name of the queue manager or queue manager alias, on which the queue is defined. If type MQC.MQOT_TOPIC is specified this parameter is ignored.
If the queue is a model queue, and the resolved queue manager name is not this queue manager, an MQException is thrown.
- topicString
-
topicString is combined with the topic name in the destinationName topic object.
topicString is ignored if destinationName is a queue.
- message
- The message to send. Message is an input/output object.
- putMessageOptions
-
Options controlling the actions of the put.
If we omit putMessageOptions, a default instance of putMessageOptions is created. putMessageOptions is an input/output object.
If we use the MQPMO_LOGICAL_ORDER option in a reconnectable client, the MQRC_RECONNECT_INCOMPATIBLE reason code is returned.
- alternateUserId
-
Specifies an alternate user identifier used to check authorization when placing the message on a queue.
We can omit alternateUserId if we do not set MQC.MQOO_ALTERNATE_USER_AUTHORITY in putMessageOptions. If you set MQC.MQOO_ALTERNATE_USER_AUTHORITY, we must also set alternateUserId. alternateUserId has not effect unless you also set MQC.MQOO_ALTERNATE_USER_AUTHORITY.
Constructors
- public MQQueueManager();
- public MQQueueManager(string queueManagerName);
- public MQQueueManager(string queueManagerName, Int options);
- public MQQueueManager(string queueManagerName, Int options, string channel, string connName);
- public MQQueueManager(string queueManagerName, string channel, string connName);
- public MQQueueManager(string queueManagerName, System.Collections.Hashtable properties);
-
Throws MQException.
Creates a connection to a queue manager. Select between creating a client connection or a server connection.
We must have inquire ( inq) authority on the queue manager when attempting to connect to the queue manager. Without inquire authority, the connection attempt fails.
A client connection is created if one of the following conditions is true:
- channel or connName are specified in the constructor.
- HostName, Port, or Channel are specified in properties.
- MQEnvironment.HostName, MQEnvironment.Port, or MQEnvironment.Channel are specified.
The values of the connection properties are defaulted in the order shown. The channel and connName in the constructor take precedence over the property values in the constructor. The constructor property values take precedence of the MQEnvironment properties.
The host name, channel name, and port are defined in the MQEnvironment class.
- queueManagerName
- Name of the queue manager, or queue manager group to connect to.
- options
- Specify MQCNO connection options. The values must be applicable to the type of connection being made. For example, if we specify the following server connection properties for a client connection an MQException is thrown.
- MQC.MQCNO_FASTPATH_BINDING
- MQC.MQCNO_STANDARD_BINDING
- properties
-
The properties parameter takes a series of key/value pairs that override the properties set by MQEnvironment ; see the example, Override MQEnvironment properties. The following properties can be overridden:
- MQC.CONNECT_OPTIONS_PROPERTY
- MQC.CONNECTION_NAME_PROPERTY
- MQC.ENCRYPTION_POLICY_SUITE_B
- MQC.HOST_NAME_PROPERTY
- MQC.PORT_PROPERTY
- MQC.CHANNEL_PROPERTY
- MQC.SSL_CIPHER_SPEC_PROPERTY
- MQC.SSL_PEER_NAME_PROPERTY
- MQC.SSL_CERT_STORE_PROPERTY
- MQC.SSL_CRYPTO_HARDWARE_PROPERTY
- MQC.SECURITY_EXIT_PROPERTY
- MQC.SECURITY_USERDATA_PROPERTY
- MQC.SEND_EXIT_PROPERTY
- MQC.SEND_USERDATA_PROPERTY
- MQC.RECEIVE_EXIT_PROPERTY
- MQC.RECEIVE_USERDATA_PROPERTY
- MQC.USER_ID_PROPERTY
- MQC.PASSWORD_PROPERTY
- MQC.MQAIR_ARRAY
- MQC.KEY_RESET_COUNT
- MQC.FIPS_REQUIRED
- MQC.HDR_CMP_LIST
- MQC.MSG_CMP_LIST
- MQC.TRANSPORT_PROPERTY
- channel
- Name of a server connection channel
- connName
- Connection name in the format HostName (Port.
Set the Connection List
We can set the connection list by using the following methods when the automatic client reconnection options are set:
- Set the connection list through MQSERVER
- We can set the connection list through the command prompt.
At the command prompt, set the following command:
MQSERVER=SYSTEM.DEF.SVRCONN/TCP/Hostname1(Port1),Hostname2(Por2),Hostname3(Port3)
For example:MQSERVER=SYSTEM.DEF.SVRCONN/TCP/fred.mq.com(5266),nick.mq.com(6566),jack.mq.com(8413)
If you set the connection in the MQSERVER, do not set it in the application.
If you set the connection list in the application, the application overwrites whatever is set in the MQSERVER environment variable.
- Set the connection list through the application
- We can set the connection list in the application by specifying the host name and port properties.
String connName = "fred.mq.com(2344), nick.mq.com(3746), chris.mq.com(4288)"; MQQueueManager qm = new MQQueueManager("QM1", "TestChannel", connName);
- Set the connection list through app.config
- App.config is an XML file where you specify the key-value pairs.
In the connection list specify
<app.Settings> <add key="Connection1" value="Hostname1(Port1)"/> <add key="Connection2" value="Hostname2(Port2)"/> <app.Settings>
For example:<app.Settings> <add key>="Connection1" value="fred.mq.com(2966)"/> <add key>="Connection2" value="alex.mq.com(6533)"/> <app.Settings>
We can directly change the connection list in the app.config file.
- Set the connection list through MQEnvironment
- To set the Connection list through the MQEnvironment, use the ConnectionName property.
MQEnvironment.ConnectionName = "fred.mq.com(4288),"alex.mq.com(5211);
The ConnectionName property overwrites the host name and port properties set in the MQEnvironment.
Create a client connection
The following example shows you how to create a client connection to a queue manager. We can create a client connection by setting the MQEnvironment variables before creating a new MQQueueManager Object.
Override MQEnvironment properties
The following example shows you how to create a queue manager with its user ID and password defined in a hash table.
Create a reconnectable connection
The following example shows you how to automatically reconnect a client to a Queue Manager.
Parent topic: The IBM MQ .NET classes and interfaces