5.5. Programming with the C++ API

We will now explain how the basic MQSeries operation, such as connecting to a queue manager, opening a queue and sending or receiving messages, can be achieved using this API.

5.5.1. Connecting to the queue manager

To connect to a queue manager we will use the ImqQueueManager class, which encapsulates the MQSeries queue manager object.

The name of the queue manager can be provided in the constructor call, or by using the setName method of the ImqQueueManager class.

ImqQueueManager qmanager;
qmanager.setName(name);

or

ImqQueueManager *pmanager = new ImqQueueManager(name);

Note

We will be using the pmanager object throughout the rest of this chapter.

Then the connection can be established using the connect ...

Get MQSeries Programming Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.