Application Programming Interfaces
You can use the object-oriented programming interface to write
RTR C++
C++ applications that use RTR. For more information on the C++
Object-Oriented
object-oriented programming interface, refer to the HP Reliable
Programming
Transaction Router C++ Foundation Classes manual and the HP
Interface
Reliable Transaction Router Application Design Guide.
The following example illustrates object creation in a program
Sample C++ client
that is to act as an RTR client application. The first step is to
code
create a Transaction Controller. This is followed by creating
an RTR Data Object that will hold the ASCII message for the
server, sending the message to the server application, and finally
accepting the transaction.
//
// Create a Transaction Controller to receive incoming messages
// and events from a client.
//
RTRClientTransactionController *pTransaction = new RTRClientTransactionController();
//
// Create an RTRData object to hold an ASCII message for the server.
//
RTRData *pMessage1 = new RTRData("You are pretty easy to use!!!");
//
// Send the Server a message
//
sStatus = pTransaction->SendApplicationMessage(pMessage1);
ASSERT(RTR_STS_OK == sStatus);
//
// Since we have successfully finished our work, tell RTR we accept the
// transaction.
//
pTransaction->AcceptTransaction();
The following example illustrates creation of an object in a server
Sample C++
application that is to act as an RTR server. First it creates a key
server code
segment for a specific range of ASCII values (A to L) and creates
a data object to hold each incoming message or event. Then it
loops continuously, receiving messages and dispatching them to
the handlers.
4–18 RTR Interfaces
Need help?
Do you have a question about the Reliable Transaction Router and is the answer not in the manual?