3.11.4.1.28 PeekPreviousByLookupId (Opnum 34)
The PeekPreviousByLookupId method is received by the server in an RPC_REQUEST packet. In response, the server retrieves the Message preceding a Message from the referenced queue's MessagePositionList for which the Message.LookupIdentifier property equals the lookup identifier without removing it.
-
HRESULT PeekPreviousByLookupId( [in] VARIANT LookupId, [in, optional] VARIANT* WantDestinationQueue, [in, optional] VARIANT* WantBody, [in, optional] VARIANT* WantConnectorType, [out, retval] IMSMQMessage4** ppmsg );
LookupId: A VARIANT (VT_UI8) that contains a value that represents a position in the MessagePositionList of the referenced queue as described by the Message.LookupIdentifier property of the Message.
WantDestinationQueue: A pointer to a VARIANT (VT_BOOL).
-
If this parameter is not specified by the client, the server MUST use the default value VARIANT_FALSE (0x0000) in place of the unspecified value.
-
Value
Meaning
VARIANT_TRUE
0xFFFF
The server MUST return an MSMQMessage object that has the DestinationQueueInfo property set.
VARIANT_FALSE
0x0000
Default. The server MUST return an MSMQMessage object that does not have the DestinationQueueInfo property set.
WantBody: A pointer to a VARIANT (VT_BOOL).
-
If this parameter is not specified by the client, the server MUST use the default value VARIANT_TRUE (0xFFFF) in place of the unspecified value.
-
Value
Meaning
VARIANT_TRUE
0xFFFF
Default. The server MUST return an MSMQMessage object that has the Body property set.
VARIANT_FALSE
0x0000
The server MUST return an MSMQMessage object that does not have the Body property set.
WantConnectorType: A pointer to a VARIANT (VT_BOOL).
-
If this parameter is not specified by the client, the server MUST use the default value VARIANT_FALSE (0x0000) in place of the unspecified value.
-
Value
Meaning
VARIANT_TRUE
0xFFFF
The server MUST return an MSMQMessage object that has the ConnectorTypeGuid property set.
VARIANT_FALSE
0x0000
Default. The server MUST return an MSMQMessage object that does not have the ConnectorTypeGuid property set.
ppmsg: A pointer to a pointer to an IMSMQMessage4 interface that MUST be set by the server with the received message.
Return Values: The method MUST return S_OK (0x00000000) on success or an implementation-specific error HRESULT on failure.
When processing this call, the server MUST follow these guidelines:
If the LookupId input parameter equals 0:
Return an error HRESULT, and take no further action.
If the IsInitialized instance variable equals False:
Return an error OLE_E_BLANK (0x80040007), and take no further action.
If the IsClosed instance variable equals True:
Return an error MQ_ERROR_INVALID_HANDLE (0xC00E0007), and take no further action.
If the refQueue.AccessType is not equal to PeekAccess or PeekAdminAccess or ReceiveAccess or ReceiveAdminAccess:
Return an error MQ_ERROR_ACCESS_DENIED (0xC00E0025), and take no further action.
If the ppmsg output parameter is NULL:
Return E_INVALIDARG (0x80070057), and take no further action.
Define suitable message as the Message preceding the position in the MessagePositionList of the referenced queue identified by the LookupId input parameter (as described by the Message.LookupIdentifier), where the State property of the Message does not equal Locked or Message.AllowPeekWhenLocked equals True.
Attempt to retrieve the suitable message by raising the Read Message By Lookup Identifier event with the following arguments:
iQueueDesc: This MUST be set to the OpenQueueDescriptor for the referenced queue.
iLookupId: This MUST be set to LookupId.
iPeekOperation: This MUST be set to TRUE.
iLookupOperation: This MUST be set to the enumeration value MessageSeekAction.SeekPrevious.
iTransaction: This MUST be set to a reference to the Transaction object if created.
Based on the rStatus, take the following actions:
If rStatus is not MQ_OK:
Set the ppmsg output parameter to NULL.
Return MQ_ERROR_MESSAGE_NOT_FOUND (0xc00e0008), and take no further action.
Else:
Retrieve the suitable message from rMessage, and instantiate an MSMQMessage instance and initialize it with the suitable message, observing the requirements set forth by the WantConnectorType, WantBody, and WantDestinationQueue input parameters. For details of initializing the MSMQMessage object, refer to section 3.17.3.
Set the ppmsg output parameter to the newly instantiated MSMQMessage instance. Return S_OK (0x00000000), and take no further action.
Return S_OK (0x00000000), and take no further action.