3.4 Example 4: Creating and Monitoring a Remote Private Queue
This example demonstrates creating and monitoring a remote private queue as described in the Create or Modify Queue - Application (section 2.5.1) and Query Queue Information- Application (section 2.5.2) use cases.
The common prerequisites defined in section 3.
The application has access to the machine on which a queue is to be created or modified.
The application has the necessary administrative rights to execute the operation.
The application administrator completes the application-specific configuration of the Message Queuing System, such as creating the necessary queues.
The application has access to the machine and queue.
The application has the necessary administrative rights to execute the query.
Initial System State
To execute this example, the queue manager on the remote machine is operating in the queue server role.
The administrator application and the business applications are configured with the remote machine's address and the private queue's address on the remote queue manager.
Final System State
The final state of the remote queue manager has a new private queue, and the queue is in a Ready state. The query to retrieve the number of messages from the remote queue manager's private queue does not alter the state in any way.
Sequence of Events
The following figure shows the sequence of events for creating and monitoring a remote private queue.
Figure 22: Sequence diagram of events to create or modify a remote private queue
A new MSMQQueueInfo class instance is created and returned to the Admin Application.
The Admin Application sets the path name indicating the queue to be referenced by the MSMQMessageInfo class instance by invoking the PathName ([MC-MQAC] section 184.108.40.206.7) method of the IMSMQQueueInfo4 interface. Next, the Admin Application calls the Create ([MC-MQAC]section 220.127.116.11.26) method of the IMSMQQueueInfo4 interface to create a new public or private application queue.
S_OK (0x00000000) is returned to the Admin Application on success.
Once the private queue is created on the Remote Queue Manager machine, other business applications running on various application machines send messages to and receive messages from the private queue, using the local queue managers on the respective machines, depending on the functionality of the business applications. Although these activities involve the MSMQ protocols, the specifics of these activities and the related protocols are not relevant for the purpose of this example.
The Admin Application requests information about the remote queue by invoking the R_QMMgmtGetInfo ([MS-MQMR] section 18.104.22.168) method of the qmmgmt interface, providing an aProp parameter array with a single entry set to PROPID_MGMT_QUEUE_MESSAGE_COUNT ([MS-MQMQ] section 22.214.171.124).
This method returns success (MQ_OK (0x00000000)) and an apVar output parameter array with a single entry containing a PROPID_MGMT_QUEUE_MESSAGE_COUNT ([MS-MQMQ] section 126.96.36.199) property value with the number of messages in the remote queue.