-
1. Re: Narayana JTS and Blacktie XATMI Java Implementation
tomjenkinson Mar 27, 2019 1:12 PM (in response to msp691989)Hi,
Thanks for the interest in Narayana. I am wondering if this example might be interesting to you: quickstart/blacktie/integration1 at master · jbosstm/quickstart · GitHubThe client (quickstart/client.c at master · jbosstm/quickstart · GitHub) calls the service here quickstart/DebitAdapterService.java at 8dc527e39bfda429306ca35b9161b92a25d2b9c5 · jbosstm/quickstart · GitHub
The work in narayana/tx.java at master · jbosstm/narayana · GitHub is not intended to be compatible with BlackTie (it predates that work) although you are right it is a Java implementation of TX it is for demarcation of Java transactions.
Maybe some of that helps?
Thanks,
Tom
-
2. Re: Narayana JTS and Blacktie XATMI Java Implementation
syedatifhusain Mar 28, 2019 1:01 PM (in response to tomjenkinson)Hi,
Thank you for the response.
But above example code has the transaction manager logic in C and Java code is only the EJB which has independent logic.
We are trying to implement transaction management using Java and call that from C code. So that transaction management can happen in Java [this is needed because Postgres doesn't have a C API for XA].
Regards,
Atif
-
3. Re: Narayana JTS and Blacktie XATMI Java Implementation
tomjenkinson Mar 29, 2019 5:55 AM (in response to syedatifhusain)Are you trying to use something from the APIs in `#include <jni.h>` from a C program to use the PostGres Java driver?
That won't work out of the box because the transaction is on two different threads effectively. The thread that is used from tx_begin in the C code won't be shared with the one in the JNI called called, at least I would expect that it is not.
-
4. Re: Narayana JTS and Blacktie XATMI Java Implementation
zhfeng Mar 30, 2019 9:30 AM (in response to syedatifhusain)Hi Syed Husain,
As I understand, your legacy application was written by C and running in the Tuxedo environment while connecting to the oracle database backend. Now you are trying to move to Blacktie and Postgres. I assume that your service codes look like
tp_begin(); tp_call("SVC1", ...); tp_call("SVC2", ...); other_business_login(); tp_commit();
The SVC1 and SVC2 could use the Postgres XA driver to connect to the backend database. I think the SVC1 and SVC2 have to be re-written by Java. And the main business logic invoking these services could be re-compiled with the Blacktie C library.
Is it correct ? or you can provide us more about the scenario ?
-
5. Re: Narayana JTS and Blacktie XATMI Java Implementation
syedatifhusain Mar 31, 2019 11:52 AM (in response to zhfeng)Hi,
If we recompile the main business logic - invoking these services - using blacktie, won't that start the transaction using the C driver? (as part of tp_begin() which will be implemented using blacktie). How will it work with transaction started using blacktie C code and DB services written in Java?
Your assumption is almost correct. We have business logic in C and also in embedded sql in C which talks to Oracle.
Regards,
Atif
-
6. Re: Narayana JTS and Blacktie XATMI Java Implementation
tomjenkinson Apr 1, 2019 8:12 AM (in response to syedatifhusain)I think I didn't respond well to your original point about quickstart/blacktie/integration1 at master · jbosstm/quickstart · GitHub . The transaction that is started quickstart/client.c at master · jbosstm/quickstart · GitHub propagates to quickstart/CreditAdapterService.java at master · jbosstm/quickstart · GitHub and so updates done in quickstart/CreditBean.java at master · jbosstm/quickstart · GitHub would be committed by quickstart/client.c at master · jbosstm/quickstart · GitHub
-
7. Re: Narayana JTS and Blacktie XATMI Java Implementation
zhfeng Apr 1, 2019 10:28 AM (in response to syedatifhusain)1 of 1 people found this helpfulThanks and I think you need to check the quickstart/blacktie/integration1 which Tom has mentioned before to see if it works with your requirements. I could point out that the blacktie uses the RTS subsystem in the wildfly which provides RESTful Transaction Manager interface. You can consider it as an external transaction coordinator.
-
8. Re: Narayana JTS and Blacktie XATMI Java Implementation
syedatifhusain Apr 4, 2019 7:04 AM (in response to zhfeng)Thanks. A separate question on JTA vs JTS options in Narayana.
If we have two separate database instances, can we use JTA to support global transactions or do we have to go with JTS model only?
-
9. Re: Narayana JTS and Blacktie XATMI Java Implementation
tomjenkinson Apr 4, 2019 9:00 AM (in response to syedatifhusain)Assuming they are both in the same JVM then JTA without JTS can coordinate transactions to multiple datasources. But if there is much more to the question I suggest a separate thread. My answer was primarily from raw JTA side and not BlackTie so if there is some interaction with BlackTie we should have a separate thread with the overview.
Thanks!