Cursor Behavior and Message Priority

 

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

When messages with different priority levels are sent to a queue, Message Queuing inserts each message in a location based on its individual priority level and the priority levels of the messages already in the queue; new messages are not necessarily added to the end of the queue. As a result, when you are moving a cursor sequentially through the queue, messages may be inserted before or after the cursor.

This means that if the cursor is pointing to a message (not the end of the queue) whose priority level is 3, your application will miss any higher-priority messages that reach the queue. Messages with the same or lower priority will not be missed because they are inserted between the cursor and the end of the queue.

<No Change>

However, if the cursor is waiting for a new message at the end of the queue, Message Queuing will move the cursor to the location of the new message regardless of where it is placed in the queue.

<No Change>

Note

Messages with the same priority are placed in chronological order. For example, a new priority 1 message is placed at the front of the queue if no other priority 1 messages exist, or following any priority 1 messages if others already exist.

More Information

For information on See
How a cursor is moved to the first message when the cursor is created. Cursor Behavior when Creating a Cursor
How the cursor is moved when peeking at messages Cursor Behavior when Peeking at Messages
How the cursor is moved when retrieving messages Cursor Behavior when Retrieving Messages
How the cursor is moved when reaching the end of the queue Cursor Behavior when Reaching the End of the Queue
How multiple cursors interact Cursor Behavior when Using Multiple Cursors
How the cursor behaves when waiting for new messages at the end of the queue. Cursor Behavior when Waiting for New Messages
How the cursor behaves when trying to read a message that was removed by someone else. Cursor Behavior When Messages are Not Available
How the behaves when errors occur. Cursor Behavior Due to Errors
How the cursor behaves when trying to read messages from a deleted queue Cursor Behavior and Deleted Queues
Summary of COM methods that use cursors for synchronous and asynchronous operations Cursors and COM Components
Example code that navigates a queue based on cursors. Navigating Queue Examples