Getting and setting attribute values

The classes MQManagedObject, MQQueue, and MQQueueManager contain properties that allow you to get and set their attribute values. Note that for MQQueue, the methods work only if you specify the appropriate inquire and set flags when you open the queue.

For common attributes, the MQQueueManager and MQQueue classes all inherit from a class called MQManagedObject. This class defines the Inquire() and Set() interfaces.

When you create a new queue manager object by using the new operator, it is automatically opened for inquire. When you use the AccessQueue() method to access a queue object, that object is not automatically opened for either inquire or set operations. This is because adding these options automatically can cause problems with some types of remote queues. To use the Inquire and Set methods and to set properties on a queue, specify the appropriate inquire and set flags in the openOptions parameter of the AccessQueue() method.

The inquire and set methods take three parameters:

You do not need the SelectorCount, IntAttrCount, and CharAttrLength parameters that are found in MQINQ, because the length of an array is always known. The following example shows how to make an inquiry on a queue:

//inquire on a queue
int [ ] selectors = new int [2] ;
int [ ] intAttrs = new int [1] ;
byte [ ] charAttrs = new byte [MQC.MQ_Q_DESC_LENGTH];
selectors [0] = MQC.MQIA_DEF_PRIORITY;
selectors [1] = MQC.MQCA_Q_DESC;
queue.Inquire(selectors,intAttrs,charAttrs);
ASCIIEncoding enc = new ASCIIEncoding();
String s1 = "";
s1 = enc.GetString(charAttrs);


csqzav0536