![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
This section demonstrates the control flows for a synchronous or asynchronous client and a synchronous or asynchronous server. Code examples can be found in the operation sample program.Figure 19 Control Flow for Synchronous Clients
1. The custom adapter calls the MOperationRequest constructor.
2. The SDK creates the MOperationRequest instance.
3. The custom adapter calls MOperationRequest::syncInvoke().
5. The server returns an MOperationReply. The server can be either synchronous or asynchronous.
− A synchronous server provides an implementation where the reply can immediately be built and sent back
− An asynchronous server provides an implementation where the reply is built asynchronously. When the reply is ready, it is sent back to the client.
6. The custom adapter calls the MOperationRequest::getReply() method to retrieve the arguments and continue work.Asynchronous clients use the control flow shown below. The step 3, step 4, and step 7 are different from the synchronous client.Figure 20 Control Flow for Asynchronous Clients
1. The invoking application calls the MOperationRequest constructor.
4. The custom adapter calls the MOperationRequest::asyncInvoke() method.
6. The server returns an MOperationReply().
7. The custom adapter calls onReply() in the reply listener class.
1. In the TIBCO Designer software, define a Request-Response Service and specify the transport type (TIBCO Rendezvous or TIBCO Enterprise Message Service). The corresponding endpoints and sessions are generated automatically.
2. Define subclasses of MOperationImpl and define the onInvoke() method. This method is called in response to a client request.
3. Create instances of adapter-defined subclasses of MOperationImpl using the class and operation name and the server name declared in the Server endpoint object.
4. Bind each MOperationImpl instance to the appropriate server using the servername parameter of the constructor.Implementing an asynchronous server is similar to implementing a synchronous server. In C++, the custom adapter must, however, take ownership of the Reply handle so that the object is not deleted.
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |