You can browse queues for messages using a filter, for example message ID or priority . Browsing retrieves all the messages that match the filter, but leaves them on the queue. The queue can belong to a local or remote queue manager.
MQeVectorHndl hListMsgs; rc = mqeQueueManager_browseMessages(hQueueManager, &exceptBlock, &hListMsgs, hQMName, hQueueName, hFilter, NULL,MQE_FALSE); if (MQERETURN_OK == rc) { /* process list using mqeVector_* apis */ /* free off the vector */ rc = mqeVector_free(hListMsgs,&exceptBlock); }
Returning an entire collection of messsages can be expensive in terms of system resources. Setting the justUID parameter to true and returns the uniqueID of each message that matches the filter only.
The messages returned in the collection are still visible to other MQe APIs. Therefore, when performing subsequent operations on the messages contained in the enumeration, the application must be aware that another application can process these messages once the collection is returned. To prevent other applications from processing messages, use the browseMessagesAndLock method to lock messages contained in the enumeration.