Programming Guide |
Starts a middleware transaction
xa_begin [ EXCEPTION_HANDLERhandler
, UNLOAD_HANDLERhandler
,
TIMEOUTtimeout
]
- EXCEPTION_HANDLER
handler
- Specifies an exception handler to be installed for the duration of the transaction; use
NULL
if none is to be specified. For further information on exception events and handlers, refer to "Exception Events" in JetNet/Oracle Tuxedo Guide.- UNLOAD_HANDLER
handler
- Specifies an unload handler to be installed for the duration of the transaction. The handler should control all unloading of transaction data to Panther target variables; use
@NUL
L if none is to be specified.For example, this command specifies the unload handler
myhandler
:xa_begin UNLOAD_HANDLER "myhandler"For more information on unload events and handlers, refer to "Unload Events" in JetNet/Oracle Tuxedo Guide.
- TIMEOUT
timeout
- Resume processing if the transaction is not complete before
timeout
elapses. If you omit this option, transaction processing continues without a time limit. Specifytimeout
with this format:"[ +days
hours
::minutes
::]seconds
"Seconds are required; minutes, hours, or days (space delimiter between days and hours) can also be specified. If more than seconds is specified, the + symbol and the quotation marks are mandatory. If only seconds are specified, both are optional.
Note: JPL's colon preprocessor expands colon-prefixed variables. To prevent expansion of variables that contain colons, you must prefix literal colons with another colon (
::
) or a backslash (\:
).For example, this command specifies a time interval of
30
seconds:xa_begin TIMEOUT 30The following command specifies a time interval of 3 hours:
xa_begin TIMEOUT "+3::00::00"
Oracle Tuxedo
Client, Server
The
xa_begin
command initiates a transaction to be performed on XA-compliant resource managers. Once initiated, a transaction must be completed by a call to either xa_commit, xa_rollback or xa_end. When a transaction is in progress, any service requests made to XA-compliant resources can be processed on behalf of the current transaction.Use the
EXCEPTION_HANDLER
option to specify an exception handler to be installed for the lifetime of this transaction. All exceptions generated within the scope of this transaction are passed to the associated handler, unless a more specific scope has specified its own handler, for example, by an individual request.For example, this command starts a transaction with the exception handler
my_exc_handler:
xa_begin EXCEPTION_HANDLER "my_exc_handler"
Exceptions related to the parsing or execution of the
xa_begin
command do not cause the associated exception handler to be invoked, since the exception occurs before the transaction has begun.For information about event scopes and handler properties, refer to "Handler Scope and Installation"in JetNet/Oracle Tuxedo Guide.
The following application properties are affected by execution of
xa_begin
:
xa_begin
can generate the following exceptions:
// Process a bank account withdrawal.
// FML buffers are used in a call to service WITHDRAWAL
proc withd ()
vars message
//******** Perform ATM Withdrawal ********
if (account_id == "")
{
msg quiet "Account id is required"
return 0
}
if (amount > 0)
{
xa_begin
service_call "WITHDRAWAL" ({account_id, amount}, \
{message, balance = account_balance})
xa_end
if (@app()->tp_svc_outcome == TP_FAILURE)
{
msg quiet message
}
}else
{
msg quiet "Invalid withdrawal amount"
}
return 0
xa_commit, xa_end, xa_rollback