9 Replies Latest reply on Aug 13, 2014 6:06 PM by Arun R

    Using Narayana JTA standalone and enlisting multipe resources

    Josh Long Newbie



      I've been looking at the wide world of standalone JTA implementations. ( Narayana || Anjuna || JBossTS ) seem very, very powerful, and I'm keen to get it working. Thus far, I have the following : https://github.com/joshlong/spring-boot/blob/bitronix/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/NarayanaAutoConfiguration.java. If you're not familiar with Spring's Java configuration, all that class does is set some properties like ObjectStoreEnvironmentBean.objectStoreDir, register a com.arjuna.ats.jta.UserTransaction#userTransaction, register com.arjuna.ats.jta.TransactionManager#jtaTransactionManager, and then register Spring's JtaTransactionManager. The `JtaTransactionManager` wraps and delegates to an underlying JTA j.t.UserTransaction, j.t.TransactionManager, and optionally a j.t.TransactionSynchronizationRegistry.


      Then, I also register a j.s.DataSource through some awkward, not-very-satisfying hoops, using TransactionalDriver. This works, but I have gaps on where to go next. What I want to do is enlist a javax.jms.ConnectionFactory *and* a javax.sql.DataSource in a JTA transaction. I'm not sure how to make My XA JMS ConnectionFactory aware of JBoss TS. Most standalone JTA providers offer some sort of wrapper/adapter javax.sql.(XA)DataSource and wrapper/adapter javax.jms.(XA)ConnectionFactory, but I can't seem to find the equivalent here.


      Then I started reading, and found connecting the dots | Planet JBoss Developer, which implies that I need to setup a full JCA environment (like IronJacamar, which looks cool, but I'd like to avoid the exploratory rabbit hole until I know I'm going down the right one...). 


      So, my question(s) are: what's the *right* way to get a j.s.(XA)DataSource *and* a j.j.(XA)ConnectionFactory enlisted in the same transaction managed by JBoss TS, in a standalone scenario? Does it involve setting up IronJacamar? If so, would you point me in the right direction? Code examples of JBoss TS and/or, if required, IronJacamar and friends, working together? Comments on the technical approach and/or feasibility? Thanks in advance for your help. 


      From what I can tell, JBoss TS looks like it could be one of the better (certainly most feature-complete! I don't think even the proprietary Atomikos extensions support all the use cases as Narayana JTS/JTA/REST/WS's supports) standalone JTA implementations out there, so thanks for doing such good work. I'm eager to be able to use it.


      Mark Little arungupta