There are two ways of inquiring on a queue: inquire and inquireAll.
InquireAll will return a Fields object in the admin reply message.
/* Create an empty queue admin message and parameters field*/ MQeQueueAdminMsg msg = new MQeQueueAdminMsg(); /*Prime message with who to reply to and a unique identifier * Set the admin action to get all characteristics of queue manager. */ msg.inquireAll(new MQeFields()); /* get message back from the admin reply queue to match */ /* and retrieve the results from the reply message */
The fields object that is returned in the administration reply message is populated with all of the properties of the queue. To get access to a specific value use the field labels as in the property table above. For example, to get at the queue description, assuming respMsg is the administration reply message:
// all on one line: String description = respMsg.getOutputFields(). getAscii(com.ibm.mqe.administration.Queue_Description)
Instead of requesting all the properties of a queue, particular ones can be requested and returned. If, for example, only the description is required the following can be used:
MQeFields requestedProperties = new MQeFields(); requestedProperties.putAscii(Queue_Description); msg.inquire(requestedProperties) /* Retrieve the administration reply */ /* message from the relevant queue */ /* Then retrieve the returned MQeFields */ /* object from this message */ MQeFields outputFields = respMsg.getOutputFields();
outputFields now contains the field Queue_Description only.