Connecting to and disconnecting from a queue manager

When we have configured the IBM MQ environment, you are ready to connect to a queue manager.

To connect to a queue manager, create a new instance of the MQQueueManager class:
MQQueueManager queueManager = new MQQueueManager("qMgrName");
To disconnect from a queue manager, call the Disconnect method on the queue manager:
queueManager.Disconnect();

You must have inquire ( inq) authority on the queue manager when attempting to connect to the queue manager. Without inquire authority, the connection attempt fails.

If you call the Disconnect method, all open queues and processes that we have accessed through that queue manager are closed. However, it is good programming practice to close these resources explicitly when you finish using them. To close the resources, use the Close method on the object associated with each resource.

The Commit and Backout methods on a queue manager replace the MQCMIT and MQBACK calls that are used with the procedural interface.