Developing .NET applications

IBM® MQ classes for .NET allow .NET applications to connect to IBM MQ as an IBM MQ MQI client or to connect directly to an IBM MQ server.

Before you begin

[Deprecated][MQ 9.4.0 Jun 2024][MQ 9.4.0 Jun 2024]From IBM MQ 9.4.0, in IBM MQ classes for .NET, the methods WriteObject(), ReadObject(), CreateObjectMessage(), and the classes ObjectMessage and XmsObjectMessageImpl used for serialization and deserialization of data are deprecated.

[Removed][MQ 9.4.0 Jun 2024][MQ 9.4.0 Jun 2024]The IBM MQ .NET client library built using .NET Standard 2.0, which was deprecated at IBM MQ 9.3.1, has been removed from the product at IBM MQ 9.4.0.

About this task

IBM MQ classes for .NET is a set of classes that enable .NET applications to interact with IBM MQ. They represent the various components of IBM MQ which your application uses, such as queue managers, queues, channels and messages. For more information about these classes, see The IBM MQ .NET classes and interfaces.

[MQ 9.4.0 Jun 2024]IBM MQ 9.4.0 provides an IBM MQ .NET client library built against .NET 6 as the target framework. For more information, see Installing IBM MQ classes for .NET.

[MQ 9.4.0 Jun 2024][MQ 9.4.0 Jun 2024]From IBM MQ 9.4.0, IBM MQ supports .NET 8 applications using IBM MQ classes for .NET. For more information, see Installing IBM MQ classes for .NET.

If you have applications that use Microsoft .NET Framework and want to take advantage of the facilities of IBM MQ, you must use IBM MQ classes for .NET Framework. For more information, see Installing IBM MQ classes for .NET Framework.

For more information about the differences between IBM MQ classes for .NET Framework and IBM MQ classes for .NET, see Installing IBM MQ classes for .NET.

IBM MQ .NET managed applications are able to automatically balance connections across clustered queue managers. Both the IBM MQ classes for .NET and the IBM MQ classes for .NET Framework libraries are supported. For more information, see About uniform clusters and Automatic application balancing.

The object-oriented IBM MQ .NET interface is different from the MQI interface in that it uses methods of objects rather than using the MQI verbs. The procedural IBM MQ application programming interface is built around verbs such as those in the following list:
       MQCONN, MQDISC, MQOPEN, MQCLOSE, 
       MQINQ, MQSET, MQGET, MQPUT, MQSUB  

These verbs all take, as a parameter, a handle to the IBM MQ object on which they are to operate. Because .NET is object-oriented, the .NET programming interface turns this round. Your program consists of a set of IBM MQ objects, which you act upon by calling methods on those objects. You can write programs in any language supported by .NET.

When you use the procedural interface, you disconnect from a queue manager by using the call MQDISC( Hconn, CompCode, Reason), where Hconn is a handle to the queue manager. In the .NET interface, the queue manager is represented by an object of class MQQueueManager. You disconnect from the queue manager by calling the Disconnect() method on that class.

// declare an object of type queue manager
MQQueueManager queueManager=new MQQueueManager();
...
// do something...
...
// disconnect from the queue manager
queueManager.Disconnect();