![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
The remote operation paradigm in the Java SDK is similar to that in the C++ SDK, with two exceptions:
• There are MClientRequest/MClientReply and MServerRequest/MServerReply classes (instead of just MOperationRequest and MOperationReply)
• In addition to using any of the onInvoke() methods, Java programmers can take advantage of the Java introspection mechanism to use an adapter-defined method with a name of their choice.This section gives an overview of ActiveEnterprise operation programming, which is also illustrated by the zapadapterRPC example program.
• Remote invocation operations, their parameters, and the exceptions they raise are defined in the Schemas folder.
• Protocol information for both client and server is defined as part of the Generic Adapter Configuration.See the TIBCO Designer Palette Reference available via Help > Designer Help from TIBCO Designer. See also Defining Endpoints and Protocols.The endpoint and protocol information is defined using TIBCO Designer. For example, the following information is required to define an endpoint named client1 and an endpoint named server1.
• There is no RvCmqClient in this example because certified remote operations are implemented with an RvCmClient.
1. Create a subclass of MOperationImpl.
2. Create a method that you want to be invocable by a client through the remote operation service. Override either onInvoke() or onOnewayInvoke() to provide a meaningful implementation (depending on whether the operation is defined as one-way).
3. If you choose to implement onInvoke(), an MServerReply object is passed to the callback method. The custom adapter is responsible for calling reply() on this object to send back the reply. The resulting behavior is that of an asynchronous server.
1. Create an MOperationImpl subclass.
2. Define a Java method whose name and parameter signature match the operation description provided in the repository.
− You can also choose to have the returned value of the Java method be of type MServerReply. In that case, the MServerReply object can hold the returned value and/or the in and in-out parameter values. If you have in-out parameters in the operation description, return MServerReply from the operation method.
− Exception of any type can be thrown whenever appropriate; however, only exceptions of type MOperationException are caught and forwarded back to the requestor. Other exceptions are just logged locally.
Whether a reply is sent back depends on the operation’s one-way property. Nevertheless, the custom adapter must not call reply() on the MServerReply object even if it uses it to pass back information to the client. The SDK sends back the reply if appropriate.If a method as described above exists (determined by class introspection), it takes precedence over either onInvoke() or onOnewayInvoke().
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |