Example - C

Example of BrowseAndLock (C)

The C codebase example gets the actual message. Note the additional parameters, a confirmID in case the operation needs undoing, and the lockID.

  MQeVectorHndl hMessages;
  MQEINT64 lockID, confirmID=42;
  rc = mqeQueueManager_browseAndLock(hQueueManager, 
                              &exceptBlock, 
                              &hmessages,
                              &lockID, 
                              hQueueManagerName,
                              hQueueName,
                              hFilter, 
                              NULL,      /*No Attribute*/
                              confirmID,
                              MQE_TRUE);    /*Just UIDs*/
  /*process vector*/
  MQeFieldsHndl hGetFilter;
  rc = mqeFields_new(&exceptBlock, &hGetFilter);
  if (MQERETURN_OK == rc){
    rc = mqeFields_putInt64(&hGetFilter, 
                       &exceptBlock,
                       MQE_MSG_LOCKID,
                       lockID);
      if (MQERETURN_OK == rc){
        rc = mqeQueueManager_getMessage(&hQueueManager, 
                               &exceptBlock,
                               hQueueManagerName,
                               hQueueName,
                              hGetFilter,
                              &hMsg);
  }
            

Parent topic: Browse and Lock