The RemoteQMStartReceive2 method functions in the same way as RemoteQMStartReceive (section 3.1.4.1), except that it returns a structure that contains the SequentialId of the message.<25>

 HRESULT RemoteQMStartReceive2(
   [in] handle_t hBind,
   [out] PCTX_REMOTEREAD_HANDLE_TYPE* pphContext,
   [in, out] REMOTEREADDESC2* lpRemoteReadDesc2
 );

hBind: MUST be set to an RPC binding handle, as specified in [MS-RPCE] section 2.

pphContext: The server MUST return a non-NULL value for this handle upon success for receive calls. This handle will be used by the client in subsequent calls to RemoteQMEndReceive (section 3.1.4.2). This handle MUST NOT be set upon failure or for peek calls. If this method returns an error, pphContext is undefined and MUST NOT be used as an argument for a call to RemoteQMEndReceive.

lpRemoteReadDesc2: A pointer to an instance of a REMOTEREADDESC2 (section 2.2.2.2) structure. The SequentialId member MUST be set to the least significant 7 bytes of the Message.LookupIdentifier ([MS-MQDMPR] section 3.1.1.12) of the message that is returned by this method.

The client MUST provide all parameters of lpRemoteReadDesc2.pRemoteReadDesc that are marked as to be set by the client in section 2.2.2.1.

The lpRemoteReadDesc2.pRemoteReadDesc.ulAction parameter MUST be one of the following values.

Value of ulAction

Meaning

MQ_ACTION_RECEIVE

0x00000000

If hCursor is nonzero, read and remove the first message available at the current cursor location walking toward the end of the queue.

If hCursor is zero, read and remove the message from the front of the queue.

MQ_ACTION_PEEK_CURRENT

0x80000000

If hCursor is nonzero, read the message at the current cursor location, but do not remove it from the queue. The cursor location does not change after the operation.

If hCursor is zero, read the message at the front of the queue, but do not remove it from the queue.

MQ_ACTION_PEEK_NEXT

0x80000001

Read the message following the message at the current cursor location, but do not remove it. The cursor location will then change to the next available message, walking toward the end of the queue.

The hCursor parameter MUST be set to a nonzero cursor handle.

The hCursor member of lpRemoteReadDesc specifies a handle to an opened cursor. A value of zero indicates that a cursor is not used for this operation.

The dwRequestID member of the lpRemoteReadDesc parameter is used in a subsequent call to RemoteQMEndReceive or RemoteQMCancelReceive to correlate that call with the call to RemoteQMStartReceive2.

Return Values: On success, this method MUST return MQ_OK (0x00000000).

If an error occurs, the server MUST return a failure HRESULT, and the client MUST treat all failure HRESULTs identically.

Exceptions Thrown: No exceptions are thrown except those thrown by the underlying RPC protocol, as specified in [MS-RPCE].

While processing this method, the server MUST: