Cursor Behavior when Reaching the End of the Queue

 

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

The end of the queue can be thought of as a message location even though no message is there. When the cursor reaches this location, it waits for a new message to arrive or a time-out to occur.

Note

If your application tries to move past the end of the queue an MQ_ERROR_ILLEGAL_CURSOR_ACTION error is returned. For example, if you retrieve the last message in the queue and then try to do a peek-next operation, MQ_ERROR_ILLEGAL_CURSOR_ACTION error is returned

<No Change>

The cursor can point to the end of the queue as a result of the following operations:

  • The cursor points to a queue that contains no messages.

  • The cursor is moved to the end of the queue by the receiving application performing a peek-next operation.

  • The cursor is moved to the end of the queue by Message Queuing when the last message in the queue is removed.

When the cursor is waiting at the end of the queue and a new message arrives, Message Queuing moves the cursor to the location of the new message, regardless of where the new message is placed in the queue. Typically, messages are inserted at the end of the queue; however, messages can be placed in other locations depending on the priority level of the new message and the priority level of the messages already in the queue.

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