Programming Guide |
Completes an XA-compliant transaction
xa_end
Oracle Tuxedo
Client, Server
The
xa_end
command terminates a middleware transaction. It checks thetp_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 thetp_tran_status
application property.xa_end
can set thetp_return
property to one of these values:
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
Because
xa_end
implicitly performs either xa_commit or xa_rollback, refer to those commands for possible exceptions.
xa_begin, xa_commit, xa_rollback