FAQ: How do I Filter Messages with Specific Property Values?Last reviewed: January 28, 1998Article ID: Q176016 |
The information in this article applies to:
SUMMARYWhen you retrieve a message that is not at the front of the queue and its properties match with specific values (values for PROPID_M_MSGID, PROPID_M_CORRELATIONID, or any other property), use MQCreateCursor(), MQ_ACTION_PEEK_NEXT, and MQ_ACTION_PEEK_CURRENT functionality in MQReceiveMessage().
MORE INFORMATIONWhen you use Microsoft Message Queue Server 1.0, applications need to perform filtering on their own. Examine the appropriate message properties and decide whether to skip to the next message or not. Note that you usually do not need to rescan the entire queue. By using a cursor, you examine only new messages arriving to the queue. The MQ_ACTION_PEEK_NEXT and MQ_ACTION_PEEK_CURRENT functionality in C API MQReceiveMessage() may be used to implement your own filtering logic. The receive/peek function is designed to always start at the beginning of the queue and then allow a cursor to be used to traverse the messages in the queue. You are unable to directly address a specific message by any of its properties. One way to get to the specific message is to specify a cursor and then PEEK_NEXT your way through the messages, retrieving only the specific property as your search criteria (PROPID_M_MSGID or any other property). When you find the message you want, you can perform a full receive/peek CURRENT operation to retrieve other properties of that message. Retrieving arbitrary properties for a message works for the MSMQ C API only. ActiveX Receive methods let you exclude body and DestinationQueueInfo by specifying WantBody and WantDestinationQueue flags.
REFERENCESFor more information or to see a code example to find a specific message using cursors, search the "Reading Messages Using a Cursor" topic in the MSMQ SDK help file. (c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Syed Yousuf, Microsoft Corporation |
Additional query words: filter sort
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |