3.3.4.1.4 MessageCount (Opnum 10)

The MessageCount method is received by the server in an RPC_REQUEST packet. In response, the server MUST return the number of messages in the represented Queue.

 [propget] HRESULT MessageCount(
   [out, retval] long* plMessageCount
 );

plMessageCount: A pointer to a long that, when successfully completed, contains the number of messages in the represented Queue.

Return Values: The method MUST return S_OK (0x00000000) to indicate success or an implementation-specific error HRESULT on failure.

When processing this call, the server MUST follow these guidelines:

  • If the ObjectIsInitialized instance variable is False:

    • The server MUST return MQ_ERROR_UNINITIALIZED_OBJECT (0xC00E0094) and take no further action.

  • The server MUST generate a QMMgmt Get Info event with the following inputs:

    • iPropID = PROPID_MGMT_QUEUE_MESSAGE_COUNT

    • If the rStatus return value is not equal to MQ_OK (0x00000000), the server MUST return rStatus and take no further action.

    • Else:

      • The pIMessageCount output variable MUST be set to the value of the returned rPropVar.