User Tools

Site Tools


Sidebar

Table Of Contents

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

tpgetrply

Name

tpgetrply — Get reply from asynchronous service call

Synopsis

#include <atmi.h>

int tpgetrply(int *cd, char **data, long *len, 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

Get the response from asynchronous service call. The cd is pointer to call descriptor to which value might be set, in that case only matched reply is returned, other messages are dropped. data and len are field used for storing the reply messages. Fields must be allocated by tpalloc(). In case if TPGETANY flag is used, then any first response which is received is returned to user application. In case of error, global transaction is marked for abort (if associated with current thread), except if TPNOABORT flag was specified or particular error code indicates that global transaction is not aborted.

Valid flags

TPGETANY Return first response message received. The connection identifier is stored into cd.

TPNOBLOCK Do not block for waiting on response message. Instead function returns with cd equals to 0. And function return result is SUCCEED (0).

TPSIGRSTRT Restart the system call in progress if interrupted by signal handler. This affects only underlaying mq_* function calls.

TPNOTIME Ignore timeout setting (NDRX_TOUT env variable). Wait for reply for indefinitely.

TPNOCHANGE Do not allow to change the reply buffer type. If flag is set and different buffer type is received than original, then error TPEINVAL is returned.

TPNOABORT Do not abort global transaction (if one in progress), even if service failed.

If case if reply was requested for particular cd and timeout was received (TPETIME), function does not cancel the cd. Thus if server process the request slower than timeout value, still it is possible to receive the response data with several tpgetrply() attempts on particular cd.

RETURN VALUE

On success, tpgetrply() returns 0; on error, -1 is returned, with tperrno set to indicate the error.

ERRORS

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

TPEBLOCK TPENOBLOCK was specified in flags and no message is in queue. Global transaction is not marked for abort only, if one was associated with current thread.

TPEINVAL Invalid parameter is given to function. Particularly pointer parameters are NULL. Global transaction is not marked for abort only, if one was associated with current thread.

TPEBADDESC cd parameter points to not issued or canceled call descriptor and TPGETANY flag was not specified. Global transaction is not marked for abort only, if one was associated with current thread.

TPETIME Service did not reply in given time (NDRX_TOUT time).

TPESVCFAIL Service returned TPFAIL. This is application level failure.

TPESVCERR System level service failure. Server died during the message presence in service queue. Or internals of tpreturn(3) failed at server code, e.g. failed to commit auto-tran.

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.

TPETRAN Called service is configured as auto-tran, but internal tpbegin(3) at XATMI server code failed. Or server failed to join global transaction. See reasons in log file.

TPEITYPE There was problem with XATMI data type buffer, not supported by service or corrupted. Global transaction is not marked for abort only, if one was associated with current thread.

EXAMPLE

See atmitest/test018_tpacalltout/atmiclt18.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd