<div class="content" name="R_EndTransactionalReceive" uuid="f15f7fba-9259-4641-ab05-08a0485f5a8a"><p>The client MUST invoke the <b>R_EndTransactionalReceive</b>
method to advise the server that the <span><a href="b23ea276-dfad-4083-bc48-d0f8a40255fd#gt_945305f4-e72a-469a-b171-59232870ede6" data-linktype="relative-path">message packet</a></span>
returned by the R_StartTransactionalReceive (Opnum 13) (section <span><a href="c5296e0c-9e12-4fe8-a25d-56924982ac3e" data-linktype="relative-path">3.1.4.13)</a></span>
method has been received by the client.<a id="Appendix_A_Target_31"></a><a aria-label="Product behavior note 31" href="4108f68e-80f5-40e1-b3df-b713cc4dff79#Appendix_A_31" data-linktype="relative-path">&lt;31&gt;</a></p><p>The combination of the <b>R_StartTransactionalReceive</b>
method and the positive acknowledgment of the <b>R_EndTransactionalReceive</b>
method ensures that a message packet is not lost in transit from the server to
the client due to a network outage during the call sequence.</p><dl>
<dd>
<div><pre> HRESULT R_EndTransactionalReceive(
   [in] handle_t hBind,
   [in] QUEUE_CONTEXT_HANDLE_NOSERIALIZE phContext,
   [in, range(1,2)] DWORD dwAck,
   [in] DWORD dwRequestId
 );
</pre></div>
</dd></dl><p><b>hBind: </b>MUST be an <span><a href="b23ea276-dfad-4083-bc48-d0f8a40255fd#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span> binding handle
parameter, as specified in <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>
section <span><a href="../ms-rpce/a01f5886-c485-4bcf-bb23-e0d755510ab7" data-linktype="relative-path">2</a></span>.</p><p><b>phContext: </b>MUST be set by the client to the <span><a href="3e818e81-b12a-4ccd-9606-f434c346a3e9" data-linktype="relative-path">QUEUE_CONTEXT_HANDLE_NOSERIALIZE</a></span>
structure used in the corresponding call to the <b>R_StartTransactionalReceive</b>
method. The handle MUST have been returned by the server in the <i>pphQueue</i>
output parameter of a prior call to the R_OpenQueue (Opnum
2) (section <span><a href="b4b3001c-f2ff-4a17-9830-7b21af371dc4" data-linktype="relative-path">3.1.4.2)</a></span> method and
MUST NOT have been closed through a prior call to the R_CloseQueue (Opnum
3) (section <span><a href="e480114a-587f-4110-b03b-7a6188cca307" data-linktype="relative-path">3.1.4.3)</a></span> method.
This value MUST NOT be NULL.</p><p><b>dwAck: </b>MUST be set to an Acknowledgment (ACK)
or a Negative Acknowledgment (NACK) for the message packet received from the
server in an <b>R_StartTransactionalReceive</b> method request. The following
table lists possible values.</p><table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>RR_ACK 0x00000002</td>
  <td>The client acknowledges that the message packet was received successfully. The server MUST NOT remove the packet from the queue. The server removes the packet from the queue when the transaction is committed.</td>
 </tr><tr>
  <td>RR_NACK 0x00000001</td>
  <td>The client acknowledges that the message packet was not received successfully. The server MUST keep the message packet and make it available for subsequent consumption.</td>
 </tr></tbody></table><p><b>dwRequestId: </b>MUST be set by the client to the
same value as the <i>dwRequestId </i> parameter in the corresponding call to
the <b>R_StartTransactionalReceive</b> method. This parameter acts as an
identifier to correlate an <b>R_EndTransactionalReceive</b> method call to an <b>R_StartTransactionalReceive</b>
method call.</p><p><b>Return Values: </b>On success, this method MUST return
MQ_OK (0x00000000). </p><p>If an error occurs, the server MUST return a failure <span><a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a></span>,
and the client MUST treat all failure <b>HRESULT</b>s identically.</p><p>Exceptions Thrown:</p><p>No exceptions are thrown except those thrown by the
underlying RPC protocol, as specified in [MS-RPCE].</p><p>When processing this call, the server MUST do the following:</p><ul><li><p><span><span> 
</span></span>If the queue referenced by the <i>phContext</i> parameter handle
has no <span><a href="d068bd5b-b930-404f-a147-05b27a6a82a0" data-linktype="relative-path">PendingRequestEntry (section 3.1.1.2)</a></span>
ADM element instance in its <span><a href="9712f072-8179-43ba-861c-d9c50ab0df4f" data-linktype="relative-path">PendingRequestTable (section 3.1.1.3)</a></span>
ADM element, return MQ_ERROR_INVALID_HANDLE (0xC00E0007).</p>
</li><li><p><span><span> 
</span></span>Look up the <b>PendingRequestEntry</b> ADM element instance
referenced by the {<i>phContext</i>, <i>dwRequestId</i>} key pair in the <b>PendingRequestTable</b>
ADM element. If a match is not found on the {<i>phContext</i>, <i>dwRequestId</i>}
key pair, return MQ_ERROR_INVALID_PARAMETER (0xC00E0006). Otherwise, remove the
<b>PendingRequestEntry</b> ADM element instance from the <b>PendingRequestTable</b>
ADM element, and cancel the associated instance of <span><a href="2527bcdd-6427-4695-8755-d555c4f055f3" data-linktype="relative-path">Pending Request Cleanup
Timer (section 3.1.2.2)</a></span>.</p>
</li><li><p><span><span> 
</span></span>Find the corresponding <b>OpenQueueDescriptor</b> ADM element
instance by comparing the <i>phContext</i> parameter with the <b>Handle</b> ADM
attribute for all <b>OpenQueueDescriptor</b> ADM element instances maintained
by the local <b>QueueManager</b> ADM element instance.</p>
</li><li><p><span><span> 
</span></span>If not found, return a failure HRESULT, and perform no further
actions; otherwise, assign the found <b>OpenQueueDescriptor</b> ADM element
instance to the local variable <i>queueDesc</i>.</p>
</li><li><p><span><span> 
</span></span>Find the corresponding <b>Message</b> ADM element instance <i>fMessage</i>
by searching <i>queueDesc</i>.<b>QueueReference.MessagePositionCollection</b>
for a <b>MessagePosition</b> ADM element instance <i>fMessagePosition</i> where
<i>fMessagePosition</i>.<b>MessageReference.LookupIdentifier</b> equals the <b>LookupIdentifier</b>
ADM attribute of the <b>PendingRequestEntry</b> ADM element instance referenced
by {<i>phContext</i>, <i>dwRequestId</i>}. The corresponding <b>Message</b> ADM
element instance <i>fMessage</i> is referenced by the <b>MessageReference</b>
ADM attribute of the matching <b>MessagePosition</b> ADM element instance <i>fMessagePosition</i>.</p>
</li><li><p><span><span> 
</span></span>If not found, return MQ_ERROR_MESSAGE_NOT_FOUND (0xC00E0088).</p>
</li><li><p><span><span> 
</span></span>Set <i>rStatus</i> to the result of a <span><a href="../ms-mqdmpr/fafcf10f-d43b-475a-908c-fc39bbe9272b" data-linktype="relative-path">Dequeue
Message End</a></span> (<span><a href="../ms-mqdmpr/5eafe0a6-a22f-436b-a0d9-4cbc25c52b47" data-linktype="relative-path">[MS-MQDMPR]</a></span>
section 3.1.7.1.12) event with the following inputs: </p>
<ul><li><p><span><span>  </span></span><i>iQueueDesc</i>
:= <i>queueDesc</i>.</p>
</li><li><p><span><span>  </span></span><i>iMessage</i>
:= <i>fMessage</i>.</p>
</li><li><p><span><span>  </span></span><i>iDeleteMessage</i>
:= True if the <i>dwAck</i> parameter is equal to RR_ACK and false if the <i>dwAck</i>
parameter is equal to RR_NACK.</p>
</li><li><p><span><span>  </span></span><i>iTransactional</i>
:= True.</p>
</li></ul></li><li><p><span><span> 
</span></span>Return <i>rStatus</i>.</p>
</li></ul></div>