Forums » Enduro/X development »
Using EnduroX as Transaction manager with IBM MQ as resource manager
Added by Shrikant over 3 years ago
Hi
We are setting up EnduroX as transaction manager to use with IBM MQ as resource manager. We referred to following link
https://www.endurox.org/dokuwiki/doku.php?id=endurox:v7.5.x:guides:ex_adminman#_configuring_distributed_transactions_support
https://www.endurox.org/dokuwiki/doku.php?id=endurox:v7.5.x:manuals:libndrxxawsmqs.8
We are trying to use following method for XA for ibm mq
https://www.ibm.com/docs/en/ibm-mq/9.1?topic=managers-using-extended-transactional-client-tls-channels
Setup following XA parameters in app.ini
[@global/RM1_MQ] NDRX_XA_RES_ID=3 NDRX_XA_OPEN_STR=qmname=MYMQM NDRX_XA_CLOSE_STR=${NDRX_XA_OPEN_STR} NDRX_XA_DRIVERLIB=/endurox/lib64/libndrxxawsmqs.so NDRX_XA_RMLIB=/opt/mqm/lib64/libmqmxa64_r.so NDRX_XA_LAZY_INIT=1 NDRX_XA_FLAGS=FDATASYNC;DSYNC
ndrxconfig.xml
<server name="tmsrv"> <min>1</min> <max>1</max> <srvid>70</srvid> <cctag>RM1_MQ</cctag> <sysopt>-e ${NDRX_APPHOME}/log/tmsrv-rm3.log -r -- -t1 -l${NDRX_APPHOME}/tmlogs/rm3</sysopt> </server> <server name="MQConnTest"> <min>1</min> <max>1</max> <srvid>71</srvid> <cctag>RM1_MQ</cctag> <sysopt>-e ${NDRX_APPHOME}/log/MQConnTest.log -r </sysopt> </server>
MQConnTest SERVER code has
// if (EXSUCCEED!=tpadvertise("TESTMQSV", TESTMQSV)) { NDRX_LOG(log_error, "Failed to initialise TESTMQSV: %s", tpstrerror(tperrno)); EXFAIL_OUT(ret); } // ... void TESTMQSV() { //code to do QM operations } .....
MQclient code has
..... tpinit tpopen tpbegin tpcall(TESTMQSV) tpcommit tpclose .....
But we are getting failure in xa_start in MQConnTest.log
n:NDRX:5:181d91ac:41089:2b777e4404c0:001:20220107:185941174511:_start_entry:tmi/xa.c:0734:atmi_xa_start_entry n:NDRX:2:181d91ac:41089:2b777e4404c0:001:20220107:185941177619:_start_entry:tmi/xa.c:0755:atmi_xa_start_entry - fail: -6 [routine invoked in an improper context] n:NDRX:2:181d91ac:41089:2b777e4404c0:001:20220107:185941177632:_start_entry:tmi/xa.c:0777:finally atmi_xa_start_entry - fail: -6 [routine invoked in an improper context] n:NDRX:3:181d91ac:41089:2b777e4404c0:001:20220107:185941177639:rror_fmt_rsn:perror.c:0404:ndrx_TPset_error_fmt_rsn: 16 (TPERMERR) reason: -6 [finally atmi_xa_start_entry - fail: -6 [routine invoked in an improper context]] n:NDRX:2:181d91ac:41089:2b777e4404c0:001:20220107:185941177645:_join_or_new:tmi/xa.c:2040:Failed to join transaction! n:NDRX:2:181d91ac:41089:2b777e4404c0:001:20220107:185941177653:v_serve_call:spatch.c:0445:Failed to start/join global tx [YZT3oUBAE0QUN+1cSm6Mj2wLh1XP2gMAAQBG]!
Can you guide us to better understand the error and also let us know if there is any other way to setup the IBM MQ as RM ?
Replies (11)
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Lauris over 3 years ago
Hello,
Have you done tpopen() at tpsvrinit() in MQConnTest server?
Can you please attach server's full log file?
Thanks,
Lauris
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Shrikant over 3 years ago
Hi Lauris
Yes we are calling tpopen
int NDRX_INTEGRA(tpsvrinit)(int argc, char **argv) { int ret = EXSUCCEED; NDRX_LOG(log_debug, "tpsvrinit called"); if (EXSUCCEED!=tpopen()) { NDRX_LOG(log_error, "Failed to tpopen: %s", tpstrerror(tperrno)); EXFAIL_OUT(ret); } if (EXSUCCEED!=tpadvertise("TESTMQSV", TESTMQSV)) { NDRX_LOG(log_error, "Failed to initialise TESTMQSV: %s", tpstrerror(tperrno)); EXFAIL_OUT(ret); } out: return ret; }
attached is the log
MQConnTest.log
(24.3 KB)
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Lauris over 3 years ago
Hi,
Can you please check the IBM MQ log files as all looks correct according to MQConnTest.log. Maybe MQ logs can say more about this.
- Is MQclient also working in RM1_MQ CCTAG? Can you please try to put RM1_MQ in null switch and repeat the test?
- Another option, can you can try to add "NOJOIN" i.e. NDRX_XA_FLAGS=FDATASYNC;DSYNC;NOJOIN and repeat the test.
Thanks
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Shrikant over 3 years ago
Hi,
1. Yes the MQ client is also working with same CC tag variables exported.
Not sure what you mean by putting RM1_MQ in null switch
2. NOJOIN flag worked . The MQ calls got committed and message was put in the queue.
But when we did the rollback tests, i.e calling tpabort after tpcall(TESTMQSV) , a new message was still put on the MQ queue.
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Lauris over 3 years ago
Hi,
1. About NULL Switch, I mean, when you run the client program which only orchestrates the XATMI calls and does not work with any resource directly.
I.e. this one would use third CC tag configured with this lib: https://www.endurox.org/dokuwiki/doku.php?id=endurox:v7.5.x:manuals:libndrxxanulls.8
(but this is optional).
2. Regarding the rollback, can you please clear all the logs, run abort case, and provide archive with all Enduro/X logs from this test case? (from client/server and tmsrv).
Also maybe you could check by your self tmsrv logs what did happen during the abort execution?
Also are you sure, you are not connected to MQ directly, outside the global transaction and performed work directly with the resource?
Thanks,
Lauris
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Shrikant over 3 years ago
Hi Attaching the complete logs. It seems the RM is not attaching to the global transaction .
Can you suggest the steps to be done next .
client code is like below :
tpinit
tpopen
tpcall
tpabort
tpclose
tpterm
logs_mqtest.tar.gz (37.8 KB)
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Lauris over 3 years ago
I do not see tpabort() call performed in test_mq_client.log. Is it called?
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Shrikant over 3 years ago
apologies, attached an incorrect file
logs_mqtest.tar.gz (40.1 KB)
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Lauris over 3 years ago
All seems correct.
Can you please try to check the IBM examples MQ client for Tuxedo here https://www.ibm.com/docs/en/ibm-mq/9.1?topic=applications-cics-tuxedo-sample-programs ?
At API level all should work in exactly the same way.
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Shrikant over 3 years ago
Hello ,
Based on the above example done for Tuxedo,
we tried following instructions below , closest to our RHEL linux box
https://www.ibm.com/docs/en/ibm-mq/9.0?topic=environment-building-server-hp-ux-64-bit
We are stuck at following step to compile view
viewc -L $LD_LIBRARY_PATH amqstxvx.v
It fails with following error
N:NDRX:5:181d91ac:113604:2b1d0d9f0840:000:20220114:211002599528:rx_compile_c:pile_c.c:0199:build_cmd: [cc -o ./amqstxvx_excompiled ndrx_bc_hitfK3.c -I/endurox/include -L/endurox/lib amqstxvx_excompiled.c -latmicltbld -latmi -lubf -lnstd -lrt -ldl -lm -lc -lpthread] /usr/bin/ld: cannot find -latmicltbld /usr/bin/ld: cannot find -latmi /usr/bin/ld: cannot find -lubf /usr/bin/ld: cannot find -lnstd collect2: error: ld returned 1 exit status N:NDRX:2:181d91ac:113604:2b1d0d9f0840:000:20220114:211002697378:rx_compile_c:pile_c.c:0212:Failed to execute compiler [cc -o ./amqstxvx_excompiled ndrx_bc_hitfK3.c -I/endurox/include -L/endurox/lib amqstxvx_excompiled.c -latmicltbld -latmi -lubf -lnstd -lrt -ldl -lm -lc -lpthread]: 256 N:NDRX:2:181d91ac:113604:2b1d0d9f0840:000:20220114:211002697408:main :client.c:0209:Failed to build buildclient: 16:Failed to execute compiler [cc -o ./amqstxvx_excompiled ndrx_bc_hitfK3.c -I/endurox/include -L/endurox/lib amqstxvx_excompiled.c -latmicltbld -latmi -lubf -lnstd -lrt -ldl -lm -lc -lpthread]: 256 N:NDRX:2:181d91ac:113603:2b640f962840:000:20220114:211002698835:_view_invoke:odegen.c:0082:buildclient -f amqstxvx_excompiled.c -o ./amqstxvx_excompiled FAILED - Failed to build offset calc program N:NDRX:2:181d91ac:113603:2b640f962840:000:20220114:211002698861:enerate_code:odegen.c:0271:Failed to compile VIEW! N:NDRX:2:181d91ac:113603:2b640f962840:000:20220114:211002700238:main :/viewc.c:0223:Failed to generate code or invoke compiler!
Our endurox library is are present in /endurox/lib64. but the buildclient keeps looking at /endurox/lib folder. Possible issue in below code ?
https://github.com/endurox-dev/endurox/blob/master/buildtools/compile_c.c#L102
Any workaround to continue building the view ?
Also if we setup the server this way,
what would be NDRX_XA_DRIVERLIB and NDRX_XA_RMLIB values ?
RE: Using EnduroX as Transaction manager with IBM MQ as resource manager - Added by Madars over 3 years ago
Hi,
Compiler cannot find Enduro/X libraries. Please set export CFLAGS="-l /path/to/endurox/lib/folder" and then try again.
Also if we setup the server this way,
what would be NDRX_XA_DRIVERLIB and NDRX_XA_RMLIB values ?
If you use build tools (buildtms/buildserver/buildclient as in Tuxedo example), then CCTAGs shall be configured to resolve build in symbols via this https://www.endurox.org/dokuwiki/doku.php?id=endurox:v7.5.x:manuals:libndrxxatmsx.8 library.
One difference I see in that example is, that for our product you should use "_r" versions of the MQ libraries (e.g. libmqmxa64_r.so), please update build commands correspondingly.
PS,
In overall the main point for you is to analyze the IBM example sources to understand how they establish connections to MQ in XA environment and what libraries they use to link the processes. If you attempt the original way without the build tools, then probably your all binaries shall link to libmqmxa64_r.so lib and XATMI client/server C code shall look very similar as in IBM+Tuxedo examples.
(1-11/11)