3.11.4.1.31 Purge (Opnum 37)

The Purge method is received by the server in an RPC_REQUEST packet. In response, the server purges all Messages in the MessagePositionList of the referenced queue.

 HRESULT Purge();

This method has no parameters.

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 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 refQueue.AccessType is not equal to ReceiveAccess or ReceiveAdminAccess:

    • Return an error MQ_ERROR_ACCESS_DENIED (0xC00E0025), and take no further action.

  • Else:

    • Remove all the Messages with Message.Locked not equal to Locked in the refQueue.MessagePositionList by raising the Purge Queue event with refQueue as the only argument.

    • Return S_OK (0x00000000), and take no further action.