Navigating with Lookup Identifiers
Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista
Lookup identifiers (introduced in MSMQ 3.0) are 64-bit identifiers that are assigned to each message when the message is placed in the queue (note that the message identifier has no meaning to the sending application). The local queue manager generates the lookup identifier and sets the lookup identifier property of the message (PROPID_M_LOOKUPID and MSMQMessage.LookupId) whenever it places a message in a queue.
Message Queuing generates a lookup identifier for all messages that are placed in any queue. This includes messages sent by sending applications and Message Queuing. Note that if a message is sent to several destination queues, or if a copy of a message is stored in a computer journal or queue journal, each copy of the message will have its own lookup identifier when it is placed in its respective queue.
Lookup identifiers are used to read a specific message in the queue. Once the lookup identifier of a message is known, the receiving application can go directly to that message and then continue navigating the queue from that point. Unlike cursors that must start at the front of the queue and navigate towards the end of the queue, the receiving application can use lookup identifier calls to go directly to a message and navigate toward the front or the end of the queue.
The illustration below shows the different function and method calls used to peek at the first message in the queue (Message A), the previous, current, or next message relative to a specific message (Message C), and the last message in the queue (Message E).
More Information
For Information On | See |
---|---|
Retrieving the lookup identifier of a message | Retrieving the Lookup Identifier of a Message |
Example code that navigates a queue based on lookup identifiers | Navigating Queue Examples |