4.2 Receiving a Message

This sequence diagram illustrates a client receiving a message from a queue at the server. The call to the R_StartReceive (Opnum 7) (section 3.1.4.7) method includes a ulAction parameter value of MQ_ACTION_RECEIVE (0x00000000) and a unique dwRequestId parameter value chosen by the client. In response, the server associates a pending request with the passed dwRequestId parameter, which is used to correlate a subsequent call to the R_EndReceive (Opnum 9) (section 3.1.4.9) method or the R_CancelReceive (Opnum 8) (section 3.1.4.8) method with the same value for the dwRequestId parameter. Additionally, the server returns a SectionBuffer (section 2.2.6) array that contains the message.

Next, the client indicates that the message was successfully received by calling the R_EndReceive method, specifying RR_ACK (0x00000002) for the dwAck parameter. The server completes the corresponding pending request created by the call to the R_StartReceive method and, because RR_ACK is specified, removes the message from the queue.

The client receives a message.

Figure 2: The client receives a message.