3.1.7.1.14 Peek Next Message
This event MUST be generated with the following arguments:
iQueueDesc: A reference to an OpenQueueDescriptor (section 3.1.1.16) ADM element instance that specifies the queue from which a message is peeked.
iTimeout (Optional): The amount of time to wait in seconds.
iCursor: A reference to a Cursor (section 3.2) ADM element instance that is used for the peek-next operation.
Return Values:
rStatus: A status code that can be one of the following:
MQ_OK (0x00000000)
MQ_ERROR_IO_TIMEOUT (0xC00E001B)
MQ_ERROR_ILLEGAL_CURSOR_ACTION (0xC00E001C)
MQ_ERROR_QUEUE_NOT_AVAILABLE (0xC00E004B)
rMessage: A reference to the Message (section 3.1.1.12) ADM element instance that was peeked. The value is undefined if rStatus is not MQ_OK.
The queue manager MUST perform the following actions to process this event:
If iQueueDesc.QueueReference is NULL:
Set rStatus to MQ_ERROR_QUEUE_NOT_AVAILABLE (0xC00E004B).
Take no further action.
Set iQueue to iQueueDesc.QueueReference.
If the iTimeout argument is not specified, set it to Infinite.
Generate the Get Next Message For Peek (section 3.2.7.3) event on iCursor.
If the rStatus return value from the Get Next Message For Peek event is set to Succeeded:
Set rMessage to the returned rPosition.MessageReference.
Set rStatus to MQ_OK (0x00000000).
Take no further action.
Else, if the rStatus return value from the Get Next Message For Peek event is set to IllegalCursorAction:
Set rStatus to MQ_ERROR_ILLEGAL_CURSOR_ACTION (0xC00E001C).
Take no further action.
Else, if the rStatus return value from the Get Next Message For Peek event is set to Waiting:
Generate a Wait For New Message (section 3.1.7.3.1) event with the following inputs:
iQueueDesc := iQueueDesc
iTimeout := iTimeout
iDestructiveRead := False
iTag : = NULL
iCursor := iCursor
If the rStatus return value from the Wait For New Message event is Success:
Set rMessage to the rMessagePosition.MessageReference returned from the Wait For New Message event.
Generate the Message Available (section 3.2.7.5) event on iCursor with the following inputs:
iMessagePosition := rMessagePosition returned from the Wait For New Message event.
Generate the Release Next Reader (section 3.1.7.3.7) event with the following inputs:
iReleaseOnQueue := iQueue.
Set rStatus to MQ_OK.
Take no further action.
Else:
Generate the Wait Time Expired (section 3.2.7.6) event on iCursor.
Set rStatus to the rStatus returned from the Wait For New Message event.
Take no further action.