4.4 Application Creating and Closing a Remote Cursor Example
The following sequence diagram illustrates an application interacting with a supporting server to create a cursor for a queue located at a remote queue manager.<77>
Figure 5: Creating and closing a remote cursor
The application begins the process of creating a cursor by calling the rpc_ACCreateCursorEx (Opnum 3) (section 3.1.5.4) method of the qmcomm2 interface. A queue handle is specified, which identifies the queue with which to associate the cursor.
The supporting server, having determined that the queue is located remotely, returns the following information to the client:
A new local CursorProxy (section 3.1.1.6) ADM element instance with its Handle attribute set.
Queue context identifiers with meaning to the supporting server and remote queue manager.
A special return code: MQ_INFORMATION_REMOTE_OPERATION (0x400e03e8).
The application detects the special return code MQ_INFORMATION_REMOTE_OPERATION (0x400e03e8), which indicates that the remote queue manager has to create the cursor. In order to bind to the remote queue manager, the application determines the computer name of the remote queue manager. The application invokes the R_QMGetRemoteQueueName (section 3.1.4.1) method using the context identifier described at step 2.2.
The supporting server returns the path name for the remote queue.
The application determines the remote queue manager computer name using the path name returned at step 4. An RPC binding is established, and the port number is queried via the R_QMGetRTQMServerPort (section 3.1.4.24) method. The application then invokes the R_QMCreateRemoteCursor (section 3.1.4.4) method at the remote queue manager, specifying the context identifier returned at step 2.2.
The remote queue manager creates and returns a remote cursor identifier to the application.
The application invokes the rpc_ACSetCursorProperties (section 3.1.4.20) method, specifying the original context handle from step 1, the value of the Handle attribute of the CursorProxy ADM element instance for the local cursor from step 2.1, and the value of the Handle attribute of the Cursor ([MS-MQDMPR] section 3.2) ADM element instance for the remote cursor from step 6. The supporting server associates these values for future reference.
The application can now utilize the value of the Handle attribute of the CursorProxy ADM element instance returned at step 2.1 to perform messaging operations via the qmcomm2 interface. The supporting server delegates the operations to the remote queue manager via the qm2qm interface, as specified in [MS-MQQP].
The application closes the CursorProxy ADM element instance.
The supporting server closes the remote cursor created at step 6 via the qm2qm interface, as specified in [MS-MQQP]. Note that this step is performed in parallel and need not block the return from the rpc_ACCloseCursor (section 3.1.4.19) method invocation.