Get and setting attribute values
The classes MQManagedObject, MQQueue, and MQQueueManager contain methods 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 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 we use the AccessQueue() method to access a queue object, that object is not automatically opened for either inquire or set operations, this could cause problems with some types of remote queues. To use the Inquire and Set methods and to set properties on a queue, you must specify the appropriate inquire and set flags in the openOptions parameter of the AccessQueue() method.
The inquire and set methods take three parameters:- selectors array
- intAttrs array
- charAttrs array
//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);
All attributes of these objects can be inquired on. A subset of attributes is exposed as the properties of an object. For a list of object attributes, see Attributes of objects. For object properties, see the appropriate class description.