User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v8.0.x:api:xatmi:tpext_rmping.3

tpext_rmping

Name

tpext_rmping — XATMI extension, ping Resource Manager

Synopsis

#include <atmi.h>

int tpext_rmping(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

Perform Resource Manager ping operation, to verify the connection state. In case if reconnects are enabled in RECON in NDRX_XA_FLAGS (see ex_env(5)), this operation would perform the reconnect and results would be provided. flags shall be set to 0 or optionally bit-wise combined with bellow flags. Default ping mode (TPEXT_RMPING_MODE2 flag not set) internally uses xa_start() with TMJOIN flag set and normally it expected that resource manager returns error -4 - transaction not found.

Valid flags

TPEXT_RMPING_PREVRECON Return reconnect status, event if current ping call is OK, but there was XA connection was re-established by other functions than tpext_rmping(), before this function call.

TPEXT_RMPING_MODE2 Perform alternate validation call. This mode uses xa_recover() call to verify the connection health. In case if NDRX_XA_FLAGS contains NOJOIN flag, fallback to this method is done automatically regardless of TPEXT_RMPING_MODE2 flag use.

RETURN VALUE

On success, tpext_rmping() return zero; on error, -1 is returned, with tperrno set to indicate the error, in case if there was reconnect 1 is returned. 1 is returned also in case if reconnect was previously done by non tpext_rmping() function call and flag TPEXT_RMPING_PREVRECON was set.

ERRORS

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

TPEINVAL Invalid flags where passed.

TPEPROTO XA subsystem was not initialized (did not call tpopen()).

TPERMERR Ping failed due to Resource Manager error. The tpstrerror() and log with ndrx=5 will provide more info.

BUGS

Report bugs to support@mavimax.com

EXAMPLE

Example of XATMI server which invokes periodically (at 5 second interval) XA connection ping/check and in case of failure, callback returns error, which in standard configuration leads to XATMI server restart:

#include <atmi.h>

int periodical_cb(void)
{
    if (-1==tpext_rmping(0))
    {
        return -1;
    }

    return 0;
}

int tpsvrinit (int argc, char **argv)
{
    return tpext_addperiodcb(5, periodical_cb);
}

void tpsvrdone(void)
{
    tpclose();
}

SEE ALSO

ex_env(5)

COPYING

© Mavimax, SIA