4.1 Scenario: Retrieving the Count of Messages in a Queue

The following diagram depicts the use of MSMQManagement to retrieve the count of messages in a queue. First, an instance of the MSMQManagement object is created. Next, the MSMQManagement.Init method is called to initialize the instance to represent the state of the queue of interest. Finally, the MSMQManagement.MessageCount method is called, which returns the count of the MessagesPositionList of the represented queue.

Retrieving the count of messages in a queue

Figure 3: Retrieving the count of messages in a queue