What is in the WebSphere MQ Object Model?
The WebSphere MQ Object Model consists of the following:
- Classes representing familiar WebSphere MQ concepts such as queue managers, queues, and messages.
- Methods on each class corresponding to MQI calls.
- Properties on each class corresponding to attributes of WebSphere MQ objects.
When creating a WebSphere MQ application using the WebSphere MQ Object Model, you create instances of these classes in the program. An instance of a class in object-oriented programming is called an object. When an object has been created, you interact with the object by examining or setting the values of the object's properties (the equivalent of issuing an MQINQ or MQSET call), and by making method calls against the object (the equivalent of issuing the other MQI calls).
Classes
The WebSphere MQ Object Model provides the following base set of classes. Note that the actual implementation of the model varies slightly between the different supported object-oriented environments.
- MQQueueManager
- An object of the MQQueueManager class represents a connection to a queue manager. It has methods to Connect(), Disconnect(), Commit(), and Backout() (the equivalent of MQCONN or MQCONNX, MQDISC, MQCMIT, and MQBACK). It has properties corresponding to the attributes of a queue manager. Note that accessing a queue manager attribute property implicitly connects to the queue manager if not already connected. Destroying an MQQueueManager object implicitly disconnects from the queue manager.
- MQQueue
- An object of the MQQueue class represents a queue. It has methods to Put() and Get() messages to and from the queue (the equivalent of MQPUT and MQGET). It has properties corresponding to the attributes of a queue. Note that accessing a queue attribute property, or issuing a Put() or Get() method call, implicitly opens the queue (the equivalent of MQOPEN). Destroying an MQQueue object implicitly closes the queue (the equivalent of MQCLOSE).
- MQMessage
- An object of the MQMessage class represents a message to be put on a queue or got from a queue. It contains a buffer, and encapsulates both application data and MQMD. It has properties corresponding to MQMD fields, and methods that allow you to write and read user data of different types (for example, strings, long integers, short integers, single bytes) to and from the buffer.
- MQPutMessageOptions
- An object of the MQPutMessageOptions class represents the MQPMO structure. It has properties corresponding to MQPMO fields.
- MQGetMessageOptions
- An object of the MQGetMessageOptions class represents the MQGMO structure. It has properties corresponding to MQGMO fields.
- MQProcess
- An object of the MQProcess class represents a process definition (used with triggering). It has properties that represent the attributes of a process definition.
- MQDistributionList
- MQSeries or WebSphere MQ Version 5 products only, except WebSphere MQ for z/OS. An object of the MQDistributionList class represents a distribution list (used to send multiple messages with a single MQPUT). It contains a list of MQDistributionListItem objects.
- MQDistributionListItem
- MQSeries or WebSphere MQ Version 5 products only, except WebSphere MQ for z/OS. An object of the MQDistributionListItem class represents a single distribution list destination. It encapsulates the MQOR, MQRR, and MQPMR structures, and has properties corresponding to the fields of these structures.
Object references
In a WebSphere MQ program that uses the MQI, WebSphere MQ returns connection handles and object handles to the program. These handles must be passed as parameters on subsequent WebSphere MQ calls. With the WebSphere MQ Object Model, these handles are hidden from the application program. Instead, the creation of an object from a class results in an object reference being returned to the application program. It is this object reference that is used when making method calls and property accesses against the object.
Return codes
Issuing a method call or setting a property value results in return codes being set. These return codes are a completion code and a reason code, and are themselves properties of the object. The values of completion code and reason code are exactly the same as those defined for the MQI, with some extra values specific to the object-oriented environment.
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.