1.3.4 Access Patterns
Messages in a queue can be consumed in a first-in, first-out (FIFO) access pattern. Because messages in a queue are ordered, there is a head that represents the front of the queue and a tail that represents the end of the queue.
The protocol provides mechanisms to Peek or Receive the first message in the queue.
The protocol also allows the client to specify exactly which message to Peek or Receive, regardless of its position in the queue, through a unique lookup identifier assigned to each message by the server. A message can also be specified relative to the message identified by the lookup identifier: for example, the message immediately preceding or following the message identified by the lookup identifier.
Finally, the protocol provides a mechanism, referred to as a cursor, for sequential forward access through the queue. A cursor logically represents a current pointer that lies between the head and tail of the queue. A cursor can be specified to the Peek or Receive operation, which Peeks or Receives the message at the current pointer represented by the cursor. The cursor current pointer can be moved forward through a modified Peek operation called PeekNext. A Receive operation intrinsically moves the cursor forward.
Because cursors are stateful, the protocol provides mechanisms to create a cursor, to return a cursor handle to the client, and to close a cursor. Because a cursor represents a position within a queue, the protocol logically relates the cursor to the context handle associated with an open queue. The protocol places no limit on the number of concurrent cursors associated with a queue context handle.