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


Connection Hierarchy in Transaction Mode Diagram

The connection hierarchy is created through the following process:

  1. A client (process A) initiates a connection in transaction mode by calling tpbegin() and tpconnect().
  2. The client calls subsidiary services, which are executed.
  3. As each subordinate service completes, it sends a reply indicating success or failure (TPEV_SVCSUCC or TPEV_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().
  4. 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.