Partager via


Cursor Behavior when Using Multiple Cursors

 

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 multiple cursors are being used to read the messages in a single queue, each cursor moves independently of the others. The following illustration shows how two cursors behave independently of a third cursor.

Note

Multiple cursors should not be used if any application is reading messages through transactions. When reading messages within a transaction, Message Queuing does not roll back cursor movement if the transaction is aborted. For example, given a queue with two messages A and B, if you remove message A while in a transaction Message Queuing will move the cursor to the next message B. However, if the transaction is aborted for any reason, message A is inserted back into the queue, yet the cursor will remain pointing at message B.

Here, one cursor (Cursor 2) is pointing at a message (Message C) while the other cursor (Cursor 1) is removing messages from the queue. Cursor 1 removes messages from the queue with several receive calls while Cursor 2 remains pointing to Message C. After Cursor 1 removes Message C, Cursor 2 no longer points to a message. Cursor 2 is now pointing to a message placeholder, and an error is returned if the receiving application tries to read a message at the current Cursor 2 location. However, Cursor 2 can still be used in a peek-next operation to move the cursor to the next message.

<No Change>

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 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
How the cursor moves when the queue contains messages with different message priority levels. Cursor Behavior and Message Priority
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