Reliable Transaction Router

C++ Foundation Classes

Order Number: AA–RLE0A–TE


January 2001

 

This manual provides detailed information on the C++ object-oriented application programmer's interface for Reliable Transaction Router.

 

Revision/Update Information: This is a new manual.

Software Version: Reliable Transaction Router Version 4.0

January 2001

ã 2000 Compaq Computer Corporation

Compaq, the Compaq logo, OpenVMS, and Reliable Transaction Router Registered in U.S. Patent and Trademark Office.

Microsoft, Windows, and Windows NT are trademarks of Microsoft Corporation.
Intel is a trademark of Intel Corporation.
UNIX and The Open Group are trademarks of The Open Group.

All other product names mentioned herein may be trademarks or registered trademarks of their respective companies.

Confidential computer software. Valid license from Compaq or authorized sublicensor required for possession, use, or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.

Compaq shall not be liable for technical or editorial errors or omissions contained herein.

The information in this publication is subject to change without notice and is provided "AS IS" WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK ARISING OUT OF THE USE OF THIS INFORMATION REMAINS WITH RECIPIENT. IN NO EVENT SHALL COMPAQ BE LIABLE FOR ANY DIRECT, CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE OR OTHER DAMAGES WHATSOEVER (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION OR LOSS OF BUSINESS INFORMATION), EVEN IF COMPAQ HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THE FOREGOING SHALL APPLY REGARDLESS OF THE NEGLIGENCE OR OTHER FAULT OF EITHER PARTY AND REGARDLESS OF WHETHER SUCH LIABILITY SOUNDS IN CONTRACT, NEGLIGENCE, TORT, OR ANY OTHER THEORY OF LEGAL LIABILITY, AND NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.

The limited warranties for Compaq products are exclusively set forth in the documentation accompanying such products. Nothing herein should be construed as constituting a further or additional warranty..

Table of Contents

Preface

1 C++ API Concepts

Overview

Application Classes

Transaction Classes

Data Classes

Messages

Events

Client and Server Interaction

The Class Factory

Stream Classes

Application Classes Summary

Management Classes

Management Classes Descriptions

Processing Models

Event-Driven Model

Polling Model

Base Classes Message and Event Mapping

Client Messages

Client Events

Server Messages

Server Events for RTREvent

Using the C++ API with Existing Applications

Classes that Legacy Applications Can Use

Encapsulating Application Protocols

Implementation Example

Compiling and Linking your Application

2 Design and Implementation

Design Steps

Implementation Steps

Implementing a Server

Implementing a Client

Implementation Example

Sample Application Walkthrough

Deriving from Base Classes in the Sample Application

Adding Functionality to Data Objects

Encapsulating Data with RTRData

Examining RTRData Objects

Sample Server Application

Sample Client Application

RTR Applications in a Multiplatform Environment

Defining a Message Format

3 Application Classes

Server Classes

RTRServerEventHandler

RTRServerEventHandler Class Members

OnApplicationEvent()

OnBackendGainedLinkToRouter()

OnBackendLostLinkToRouter()

OnFacilityDead()

OnFacilityReady()

OnFrontendGainedLinkToRouter()

OnFrontendLostLinkToRouter()

OnServerGainedShadow()

OnServerIsPrimary()

OnServerIsSecondary()

OnServerIsStandby()

OnServerLostShadow()

OnServerRecoveryComplete()

RTRServerEventHandler()

RTRServerMessageHandler

RTRServerMessageHandler Class Members

OnAccepted()

OnApplicationMessage()

OnInitialize()

OnPrepareTransaction()

OnRejected()

OnUncertainTransaction()

RTRServerMessageHandler()

RTRServerTransactionController

RTRServerTransactionController Class Members

AcceptTransaction()

AcknowledgeTransactionOutcome()

ForceTransactionRetry()

GetFacilityName()

GetPartitionName()

GetProperties()

Receive()

RegisterClassFactory()

RegisterFacility()

RegisterHandlers()

RegisterPartition()

RejectTransaction()

RTRServerTransactionController()

SendApplicationEvent()

SendApplicationMessage()

UnRegisterPartition()

RTRServerTransactionProperties

RTRServerTransactionProperties Class Members

GetFacilityName()

GetTID()

GetTransactionState()

RTRServerTransactionProperties()

SetStateToAbort()

SetStateToCommit()

SetStateToDone()

SetStateToException()

TransactionIsOriginal()

TransactionIsRecovery()

TransactionIsReplay()

Client Classes

RTRClientEventHandler

RTRClientEventHandler Class Members

OnApplicationEvent()

OnFacilityDead()

OnFacilityReady()

OnFrontendGainedLinkToRouter()

OnFrontendLostLinkToRouter()

OnNewKeyRangeAvailable()

OnKeyRangeNoLongerAvailable()

OnRouterGainedLinkToBackend()

OnRouterLostLinkToBackend()

RTRClientEventHandler()

RTRClientMessageHandler

RTRClientMessageHandler Class Members

OnAccepted()

OnAllPreparedTransaction()

OnApplicationMessage()

OnInitialize()

OnRejected()

OnReturnToSender()

RTRClientMessageHandler()

RTRClientTransactionController

RTRClientTransactionController Class Members

AcceptTransaction()

Receive()

RegisterClassFactory()

RegisterFacility()

RegisterHandlers()

RejectTransaction()

RTRClientTransactionController()

SendApplicationEvent()

SendApplicationMessage()

StartTransaction()

RTRClientTransactionProperties

RTRClientTransactionProperties Class Members

RTRClientTransactionProperties()

Data Classes and the Class Factory

RTRApplicationEvent Class

RTRApplicationEvent Class Members

Dispatch()

GetEventData()

GetEventDataLength()

GetEventNumber()

SetEventData()

SetEventNumber()

RTRApplicationMessage Class

RTRApplicationMessage Class Members

Dispatch()

GetMessage()

GetMessageLength()

RTRClassFactory Class

RTRClassFactory Class Members

CreateRTRApplicationEvent()

CreateRTRApplicationMessage()

CreateRTREvent()

CreateRTRMessage()

RTRData

RTRData Class Members

Dispatch()

GetActualBufferLength()

GetLogicalBufferLength()

IsApplicationEvent()

IsApplicationMessage()

IsEvent()

IsMessage()

IsRTREvent()

IsRTRMessage()

RTRData()

RTREvent Class

RTREvent Class Members

Dispatch()

GetEventData()

GetEventDataLength()

GetEventNumber()

RTRMessage

RTRMessage Class Members

Dispatch()

GetMessageType()

GetReason()

GetSecondaryStatus()

RTRStream Class

RTRStream Class Members

operator>>

operator<<

ReadFromStream()

RTRStream()

WriteToStream()

4 Management Classes

RTR

RTR Class Members

CreateJournal()

DeleteJournal()

GetErrorText()

IsRunning()

RTR()

Start()

Stop()

StartWebServer()

StopWebServer()

RTRBackendPartitionProperties

RTRBackendPartitionProperties Class Members

GetFacilityName()

GetNumberOfRecoveredTransactions()

GetPartitionName()

GetRetryCount()

RTRBackendPartitionProperties()

SetFailoverPolicy()

SetPriorityList()

SetRecoveryRetryCount()

RTRFacilityManager

RTRFacilityManager Class Members

AddBackend()

AddFrontend()

AddRouter()

CreateFacility()

DeleteFacility()

GetFacilityProperties()

RemoveBackend()

RemoveFrontend()

RemoveRouter()

RTRFaclityManager()

RTRFacilityMember

RTRFacilityMember Class Members

GetName()

HasBackendRole()

HasFrontendRole()

HasRouterRole()

IsConnectedToLocalNode()

IsLocalNode()

RTRFacilityMember()

RTRFacilityMemberArray

RTRFacilityMemberArray Class Members

Add()

Clear()

Insert()

operator[]

Remove()

RTRFacilityMemberArray

Size()

RTRFacilityProperties

RTRFacilityProperties Class Members

GetMemberList()

RTRFacilityProperties()

SetBalance()

RTRKeySegment

RTRKeySegment Class Members

GetKeySegmentHighValue()

GetKeySegmentLength()

GetKeySegmentLowValue()

GetKeySegmentOffset()

GetKeySegmentType()

RTRKeySegment()

SetKeySegmentHighValue()

SetKeySegmentLength()

SetKeySegmentLowValue()

SetKeySegmentOffset()

SetKeySegmentType()

RTRKeySegmentArray

RTRKeySegment Class Members

Add()

Clear()

Insert()

Remove()

RTRKeySegmentArray()

Operator[]

Size()

RTRPartitionManager

RTRPartitionManager Class Members

CreateBackendPartition()

DeletePartition()

GetBackendPartitionProperties()

RTRPartitionManager()

RTRSignedCounter

RTRSignedCounter Class Members

Decrement()

GetValue()

Increment()

SetValue()

RTRSignedCounter()

RTRStringCounter

RTRStringCounter Class Members

GetValue()

SetValue()

RTRStringCounter()

RTRUnsignedCounter

RTRUnsignedCounter Class Members

Decrement()

GetValue()

Increment()

SetValue()

RTRUnsignedCounter()

 

5 Sample Application Tutorial

A C++ Foundation Class Design Diagrams

B Sample Application Diagrams

C Sample Application Code

Preface

Purpose of This Manual

This document describes the C++ interface for the Reliable Transaction Router (RTR) in which RTR concepts are represented as individual classes. The flexibility and extensibility of these classes enable existing as well as new applications to use features that were otherwise unavailable. This application programming interface (API) is backward-compatible with existing RTR applications.

Programming Requirements

Programs using the C++ API require the following files:

NT platform:

File Description
rtrapi.h Header file defining RTR classes
rtrapicpp.lib Library file that applications link against to make use of the RTRAPI
rtrapicpp.dll Library used by all RTR applications using RTR V4.0

 

UNIX platforms:

File Description
rtrapi.h Header file defining RTR classes
rtrapicpp.so File used by all RTR applications using RTR V3.2 or later

 

 

 

OpenVMS platforms:

File Description
rtrapi.h Header file defining RTR classes
rtrapicpp_shr.exe File used by all RTR applications using RTR V3.2 or later

 

Document Structure

Overview of the C++ Foundation classes and introduction to RTR application concepts. Includes C++ Foundation Class concepts and terminology and introduces RTR transactional messaging concepts for C++ API client and server applications.

There is also a section on using the C++ API with existing applications. This section describes how to use C++ Foundation classes with legacy applications.

Covers client and server application design and implementation. Provides foundation class overloading examples and design concepts.

Lists all foundation class application classes and their inherited methods. Includes separate sections for server, client, and common data classes.

Lists all C++ API management classes and their inherited methods.

Provides a walkthrough of the basics of RTR with the C++ API book processing sample application included in the examples directory of the RTR kit.

There are three appendices that offer class design diagrams, sample C++ API client and server application code examples, and a multithreading example.

 

Related Documentation

Additional resources in the RTR documentation kit include:

Document Description
Reliable Transaction Router Getting Started Provides an overview of RTR technology concepts and solutions.
Reliable Transaction Router Application Design Guide Provides design guidelines for implementing RTR client and server applications.
Reliable Transaction Router C Application Programmer's Reference Manual Explains how to design and code RTR applications; contains full descriptions of the RTR API calls for the C programming language.
Reliable Transaction Router System Manager's Manual Describes how to configure, manage, and monitor RTR.
Reliable Transaction Router Migration Guide Explains how to migrate from RTR Version 2 to RTR Version 3.
Reliable Transaction Router Installation Guide Describes how to install RTR.
Reliable Transaction Router Release Notes Describes new features, changes, and known restrictions for RTR.

 

Reader's Comments

Compaq welcomes your comments on this manual. Please send us your comments by email to rtrdoc@compaq.com. Please include the following with your comments or suggestions: the title of the manual, date from the title page, section and page numbers.

Conventions

Each class section includes member tables listing all inherited methods. The methods are in alphabetical order and provide argument types in the method column. For the argument names, see the individual method sections, which follow each class member table in alphabetical order.

The name of each method shows the class from which the method derives. For example, RTRServerTransactionController::Receive shows that the Receive method derives from the RTRServerTransactionController class.

The Prototype sections list each method with its arguments, argument types, and return types. The Return Value sections that follow contain return value information.

For each class, destructors are listed without comment along with the respective constructor. Only when there is associated behavior (an effect on another object) is there a note on a destructor.

The following table lists the typographic conventions in this manual.

Convention Description
User Input User input and programming examples are shown in a monospaced font.
Parameter Parameters you can change are shown in italics. Italics are also used for titles and chapters of manuals and books.
FE RTR Frontend
TR RTR Router
BE RTR Backend

 

 

 

Reading Path