C API

The example below shows how to inquire on the list of queues. This is the most complex inquire that can be performed as a vector of structures is returned. All these structures must be freed as shown below. This queue info structure contains three strings and a MQeQueueType. The first two strings are the QueueQueueManager Name and the QueueName. Both of these strings must be freed. Then there is the Java Class Name - this is a constant string and therefore need not be freed. Finally there is a primitive MQeQueueType.

The Queue Info structure must be freed using the mqeMemory_free function. Please see the API Reference for more information on the mqeMemory function.

As well as information on queues, a vector of connection definitions can be returned. This should also be freed when it has been processed.

   MQeQueueManagerParms qmParms = QMGR_INIT_VAL;
   qmParms.opFlags |= QMGR_QUEUES_OP;
   rc = mqeAdministrator_QueueManager_inquire(hAdministrator,
                                             &exceptBlk,
                                             &qmParms);
   if (MQERETURN_OK == rc) {
      /* This has returned a Vector of information */
      /* blocks about the queues */
      MQeVectorHndl hListQueues = qmParms.hQueues;
      MQEINT32 numberQueues;
 
      rc = mqeVector_size(hListQueues,&exceptBlk,&numberQueues);
      if (MQERETURN_OK == rc) {
         MQEINT32 count;
         /* Loop round the array to get the information */
         /* about the queues */
         for (count=0;count<numberQueues;count++) {
            MQeQMgrQParms *pQueueInfo;
            rc = mqeVector_removeAt(hListQueues,
                                   &exceptBlk,
                                   &pQueueInfo,
                                    count);
            if (MQERETURN_OK == rc) {
               /* Queue QueueManager - FREE THIS STRING when done */
               MQeStringHndl hQMgrName = pQueueInfo->hOwnerQMgrName;
               /* QueueName - FREE THIS STRING*/
               MQeStringHndl hQueueName = pQueueInfo->hQMgrQName;
              /* A Constant String matching the Java Class Name */
              /* for this queue one of
               * MQE_QUEUE_LOCAL 
               * MQE_QUEUE_REMOTE 
               * MQE_QUEUE_ADMIN 
               * MQE_QUEUE_HOME_SERVER
               */
               MQeStringHndl hQueueClassName = pQueueInfo->hQueueType;
                   
               /* Will be set from MQeQueueType */
               MQeQueueType queueType = pQueueInfo->queueExactType;
 
               (void)mqeMemory_free(&exceptBlk,pQueueInfo);
 
            }
         }
      }
 
      /* the vector needs to be freed as well */
      mqeVector_free(hListQueues,&exceptBlk);
   }


© IBM Corporation 2002, 2003. All Rights Reserved