FAQ: How do I Filter Messages with Specific Property Values?

Last reviewed: January 28, 1998
Article ID: Q176016
The information in this article applies to:
  • Microsoft Message Queue Server version 1.0

SUMMARY

When 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 INFORMATION

When 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.

REFERENCES

For 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
Keywords : MQProg kbfaq
Version : WINNT:1.0
Platform : winnt
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 28, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.