3.1.4.3 R_CloseQueue (Opnum 3)

The R_CloseQueue method closes a QUEUE_CONTEXT_HANDLE_SERIALIZE (section 2.2.4.2) handle that was previously opened by using a call to the R_OpenQueue (Opnum 2) (section 3.1.4.2) method or the R_OpenQueueForMove (Opnum 11) (section 3.1.4.11) method.

 HRESULT R_CloseQueue(
   [in] handle_t hBind,
   [in, out] QUEUE_CONTEXT_HANDLE_SERIALIZE* pphContext
 );

hBind: MUST specify an RPC binding handle parameter, as specified in [MS-RPCE] section 2.

pphContext: MUST be set by the client to the QUEUE_CONTEXT_HANDLE_SERIALIZE handle to be closed. The handle MUST have been returned by the server in the pphContext parameter of a prior call to the R_OpenQueue method or the R_OpenQueueForMove method and MUST NOT have been closed through a prior call to R_CloseQueue. This value MUST NOT be NULL. If the server returns MQ_OK, it MUST set this value to NULL.

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].

When processing this call, the server MUST:

  • Find the corresponding OpenQueueDescriptor ADM element instance by comparing the pphContext parameter with the Handle ADM attribute for all OpenQueueDescriptor ADM element instances maintained by the local QueueManager ADM element instance.

  • If not found, return a failure HRESULT.

  • Generate a Close Queue ([MS-MQDMPR] section 3.1.7.1.6) event with the following inputs:

    • iQueueDesc := The found OpenQueueDescriptor ADM element instance.

  • Find all entries in the PendingRequestTable (section 3.1.1.3) ADM element that contain the pphContext parameter, and remove these entries.

  • Set the pphContext parameter to NULL.

  • Return MQ_OK (0x00000000).