User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:xatmi:tpbegin.3

tpbegin

Name

tpbegin — Start the global transaction

Synopsis

#include <atmi.h>

int tpbegin (unsigned long timeout, long flags);

For XATMI client link with -latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm

For XATMI server link with -latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm

DESCRIPTION

Begin the global transaction. The current user must be open XA subsystem by topopen(). timeout is setting for transaction manager (tmsrv) how long transaction can hang in active state (i.e. not prepared/committed). Field flags is reserved for future use and must be 0. The work done by tpbegin() transaction is only in scope of processes which uses XA interfaces for resource managers. Any others works are outside of current scope. If timeout is set to 0, then default maximum time for transaction processing is used. Transaction must be committed or aborted by client process by using tpcommit() or tpabort(). If any tpcall() with no TPNOTRAN flag fails within given global transaction, then transaction is automatically marked as abort only.

Client process can suspend the global transaction by tpsuspend(3) and some other process can resume the transaction as client with suspend data. In that case that other process can do the commit.

If service code completes auto-tran manually and then starts new transaction in given call context, then this new transaction from tpreturn(3) and tpforward(3) perspective would be treated as continuation of the auto-tran i.e. tpreturn(3) would finish it correspondingly and tpforward(3) would receive initiator of the auto-tran.

RETURN VALUE

On success, tpbegin() return zero; on error, -1 is returned, with tperrno set to indicate the error.

ERRORS

Note that tpstrerror() returns generic error message plus custom message with debug info from last function call.

TPEINVAL flags was not 0.

TPETIME Transaction manager (tmsrv(8)) did not respond in configured time-out time. The state of transaction is unknown.

TPESVCERR Failed to call transaction manager, with service error. The state of transaction is unknown.

TPEPROTO XA subsystem was not initialized (did not call tpopen()) or global transaction already started.

TPESYSTEM System failure occurred during serving. See logs i.e. user log, or debugs for more info.

TPEOS System failure occurred during serving. See logs i.e. user log, or debugs for more info.

EXAMPLE

See atmitest/test021_xafull/atmiclt21.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd