Thanks for the interest in Narayana. I am wondering if this example might be interesting to you: quickstart/blacktie/integration1 at master · jbosstm/quickstart · GitHub
The 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?
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].
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.
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 ?
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.
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
1 of 1 people found this helpful
Thanks 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.
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?
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.