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.

 Prerequisites

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

Sequence diagram of events to create or modify a remote private queue

Figure 22: Sequence diagram of events to create or modify a remote private queue

  1. The Admin Application requests the creation of an MSMQQueueInfo ([MC-MQAC] section 3.10.3) class instance to create an application queue.

  2. A new MSMQQueueInfo class instance is created and returned to the Admin Application.

  3. 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 3.10.4.1.7) method of the IMSMQQueueInfo4 interface. Next, the Admin Application calls the Create ([MC-MQAC]section 3.10.4.1.26) method of the IMSMQQueueInfo4  interface to create a new public or private application queue.

  4. S_OK (0x00000000) is returned to the Admin Application on success.

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

  6. The Admin Application requests information about the remote queue by invoking the R_QMMgmtGetInfo ([MS-MQMR] section 3.1.4.1) method of the qmmgmt interface, providing an aProp[] parameter array with a single entry set to PROPID_MGMT_QUEUE_MESSAGE_COUNT ([MS-MQMQ] section 2.3.12.7).

  7. 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 2.3.12.7) property value with the number of messages in the remote queue.