9.4.3 Example: Committing a Transaction in Conversational Mode
The following figure illustrates a conversational connection hierarchy that includes a global transaction.
Figure 9-1 Connection Hierarchy in Transaction Mode

The connection hierarchy is created through the following process:
- A client (process A) initiates a connection in transaction mode
by calling
tpbegin()
andtpconnect()
. - The client calls subsidiary services, which are executed.
- As each subordinate service completes, it sends a reply indicating success or failure (
TPEV_SVCSUCC
orTPEV_SVCFAIL
, respectively) back up through the hierarchy to the process that initiated the transaction. In this example the process that initiated the transaction is the client (process A). When a subordinate service has completed sending replies (that is, when no more replies are outstanding), it must call tpreturn(). - The client (process A) determines whether all subordinate
services have returned successfully.
- If so, the client commits the changes made by those services, by calling tpcommit(), and completes the transaction.
- If not, the client calls tpabort(), since it knows that
tpcommit()
could not be successful.
Parent topic: Terminating the Transaction