3.2.7.2 Get Message For Peek

This event MUST be generated with the following arguments:

  • None.

Return Values:

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

    • Succeeded

    • 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 := True

        • iSeekDirection := Forward

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

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

        • 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 CursorState attribute of the Cursor ADM element instance to Read.

        • Set the MessagePositionReference ADM attribute of the Cursor ADM element instance to the rMessagePosition 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 rPosition to the MessagePositionReference ADM attribute of the Cursor ADM element instance.

        • Set rStatus to Succeeded.

        • Take no further action.

      • Else:

        • Set rStatus to AlreadyReceived.

        • Take no further action.