Programming Guide



xa_end

Completes an XA-compliant transaction

Synopsis

xa_end

Environment

Oracle Tuxedo

Scope

Client, Server

Description

The xa_end command terminates a middleware transaction. It checks the tp_tran_status property to determine whether the current transaction is successful. If no errors occurred, xa_end commits the transaction; otherwise, the transaction is rolled back. Exception handlers play a direct role in determining whether to commit or abort a transaction; the exception handler decides the actual severity of an exception, and thus determines the value set in the tp_tran_status application property. xa_end can set the tp_return property to one of these values:

Example

In the following example, the following client code makes a service call that performs an account deposit transaction. The server side of the deposit process is shown in the return command.

proc dep()
vars message
//******** Perform ATM Deposit ********
if (account_id == "")
{
msg quiet "Account id is required"
return 0
}
...
if (amount > 0)
{
xa_begin
service_call "DEPOSIT" ({account_id, amount}, \
{message, balance = account_balance})
xa_end
if (@app()->tp_svc_outcome == TP_FAILURE)
{
msg quiet message
}
}
else
{
msg quiet "Invalid deposit amount"
}
return 0

Exceptions

Because xa_end implicitly performs either xa_commit or xa_rollback, refer to those commands for possible exceptions.

See Also

xa_begin, xa_commit, xa_rollback