3.2.7.4 Get Next Message For Dequeue

This event MUST be generated with the following argument:

  • iNoWait: A Boolean that, if true, specifies that the queue manager MUST NOT wait for messages to become available if no existing messages are found in the queue.

Return Values:

  • rStatus: A status code that can be one of the following:

    • Succeeded

    • NotFound

    • AlreadyReceived

    • Waiting

  • rPosition: A reference to the MessagePosition (section 3.1.1.11) ADM element instance that contains the returned message. This value is undefined if rStatus is not set to Succeeded.

The queue manager MUST perform the following actions to process this event:

  • Define iQueue as a reference to the Queue (section 3.1.1.2) ADM element instance referenced by the QueueReference ADM attribute of the OpenQueueDescriptor (section 3.1.1.16) ADM element instance that is referenced by the OpenQueueDescriptorReference ADM attribute of the Cursor (section 3.2) ADM element instance.

  • Select from the CursorState ADM attribute of the Cursor ADM element instance:

    • Unread:

      • Generate a Seek Available Message Position (section 3.1.7.3.2) event with the following inputs:

        • iInitialPosition := Cursor.MessagePositionReference

        • iQueue := iQueue.

        • iPeekOperation := False

        • iSeekDirection := Forward

      • If rMessagePosition returned from the Seek Available Message Position event is equivalent toiQueue.MessagePositionList.End:

        • If iNoWait is set to True:

          • Set rStatus to NotFound.

          • Take no further action.

        • Set the CursorState ADM attribute of the Cursor ADM element instance to WaitReceive.

        • Set rStatus to Waiting.

        • Take no further action.

      • Else, if rMessagePosition returned from the Seek Available Message Position event is not equivalent to iQueue.MessagePositionList.End:

        • Set the MessagePositionReference ADM attribute of the Cursor ADM element instance to the rMessagePosition value returned from the Seek Available Message Position event.

        • Set rPosition to the MessagePositionReference ADM attribute of the Cursor ADM element instance.

        • Set rStatus to Succeeded.

        • Take no further action.

    • Read:

      • If Cursor.MessagePositionReference.State is Available:

        • Set the CursorState ADM attribute of the Cursor ADM element instance to Unread.

        • Set rPosition to the MessagePositionReference ADM attribute of the Cursor ADM element instance.

        • Set rStatus to Succeeded.

      • Else:

        • Set rStatus to AlreadyReceived.