4.2 Application Opening and Closing a Remote Queue Example

The following sequence diagram illustrates an application interacting with a supporting server to create a queue handle for a queue located at a remote queue manager.

Creating a queue handle

Figure 3: Creating a queue handle

  1. The application invokes the rpc_QMOpenQueueInternal method, providing a format name for a queue to open. NULL is specified for hRemoteQueue.

  2. The supporting server determines that the queue identified by the format name is a remote queue. A path name for the remote queue is returned via lplpRemoteQueueName. All returned handles are NULL.

  3. The application uses the path name returned by the rpc_QMOpenQueueInternal method to determine the computer name of the remote queue manager, as specified in [MS-MQMQ] section 2.1.1. The application then establishes an RPC connection with the remote queue manager and begins the session by invoking the R_QMGetRTQMServerPort method.

  4. The remote queue manager returns the RPC port number requested by the application.

  5. The application invokes the R_QMOpenRemoteQueue method at the remote queue manager, using the RPC port returned by the R_QMGetRTQMServerPort method and specifying the format name of the queue to be opened.

  6. The remote queue manager opens the requested queue and returns a context handle and an OpenQueueDescriptor ADM element instance with its Handle attribute set to the application.

  7. The application invokes the rpc_QMOpenQueueInternal method on the supporting server once again. For this invocation, the client provides the value of the Handle attribute of the OpenQueueDescriptor ADM element instance returned from the R_QMOpenRemoteQueue method.

  8. The supporting server binds to the remote queue manager and utilizes the qm2qm RPC protocol, as defined by [MS-MQQP], to create a remote read session. The client passes the value of the Handle attribute of the OpenQueueDescriptor ADM element instance returned at step 6, which the server uses to correlate the requests.

  9. The qm2qm protocol exchange between the supporting server and the remote queue manager produces a remote read session handle, as specified in [MS-MQQP].

  10. The supporting server internally associates the qm2qm session handle with a new local queue handle and returns the local queue handle to the application.

  11. The application, having successfully acquired a local queue handle, closes the intermediate context handle using the R_QMCloseRemoteQueueContext method.

  12. The application utilizes the local queue handle to execute remote read message operations via the qmcomm2 interface. The supporting server uses the remote read session handle to contact the remote queue manager as necessary to carry out the message operations. This process is defined by [MS-MQQP].

  13. The application is finished utilizing the local queue handle and closes it with a call to the rpc_ACCloseHandle method.

  14. The supporting server closes the remote read session handle (via the qm2qm protocol, as specified in [MS-MQQP]) that was associated with the local queue handle passed by the application at step 13. Note that the supporting server invokes the qm2qm protocol in parallel and does not block the rpc_ACCloseHandle method invocation while the session handle is being closed.