beautypg.com

HP Reliable Transaction Router User Manual

Page 75

background image

Application Programming Interfaces

Example 4–6 Starting RTR with the C++ API

//Start RTR.

RTR rtr;
rtr.Start();

Example 4–7 Creating a Facility with the C++ API

//Create facility named "myFacility".

RTRFacilityManager FacMgr;
rtr_status_t sts = FacMgr.CreateFacility("myFacility",

"router",
"frontend",
"backend",
false,
false) ;

Example 4–8 Creating a Partition with the C++ API

//Create a partition named "myPartition" in facility "myFacility."

int low = 100;
int max = 199;
RTRKeySegment Key100To199( rtr_keyseg_unsigned,

sizeof(int),
0,
&low,
&max );

RTRPartitionManager PartitionMgr;
sts = PartitionMgr.CreateBackendPartition( "myPartition",

"myFacility",
Key100To199,
false,
false) ;

RTR C
Programming
Interface

You can use the C programming interface to write C applications

that use RTR. For more information on the C programming

interface, refer to the HP Reliable Transaction Router C

Application Programmer’s Reference Manual and the HP Reliable

Transaction Router Application Design Guide.
Snippets from client and server programs using the RTR C-

programing API follow and are more fully shown in the HP

Reliable Transaction Router Application Design Guide.

RTR Interfaces 4–21