-
1. Re: XAResource
peterj May 19, 2008 2:34 PM (in response to mohitanchlia)Basically, XA transactions work like this.
A transaction manager (TM) will manage multiple resource managers (RM). The app will start a transaction with the TM. As the app make updates, it could update the data in multiple RMs, each of which is then enlisted into the transaction by the TM. Then when the app is done, it tells the TM to commit the transaction. The TM then asks each RM "can you successfully commit the transaction?" If any of the RMs respond "no," then the TM tells each RM to abort the transaction. If every RM responds "yes," then the TM goes back and tells each RM "please commit now." Now, between the "yes I can commit" response from a given RM and the "commit now" from the TM, the given RM could die. In that case, the RM is responsible to recover the transaction when it comes back up. -
2. Re: XAResource
mohitanchlia May 19, 2008 3:04 PM (in response to mohitanchlia)Thanks .. some more questions:
1. Is resouce manager active only for the scope of the transaction ?
2. So TM tells RM to not autocommit ? Is it possible to explain how and when that happens ?
3. Do RM need to register with TM ? How does it register and how does TM communicates with RM
4. In case if there is a failure between "yes ready to commit" and "please commit now" then would all the transaction(s) involved result in rollback ?
5. We are using Tibco Server along with Jboss. How would the JTA work in this case ? Would Tibco Server need to register itself as a resource manager with JTA ? Where can I see the settings ?
I read about XAResource, didn't find good article and ones I did find confused me more. -
3. Re: XAResource
peterj May 19, 2008 3:33 PM (in response to mohitanchlia)1) What do you mean by "active"? Examples of RMs included databases. Consider that the app server maintains a pool of database connections, then the database is always "active".
2) You need to configure the RM correctly. For example, for a database, in the *-ds.xml file you need to use the xa-datasource. Look at the differences in the *-ds.xml and -xa-ds.xml files for a given database in docs/examples/jca. Thus the database must support XA transactions and be configured for XA. In that event, there is no autocommit.
3) I'm a little hazy on this, but from what I understand, when you start a transaction woth the TM, the transaction object created gets passed to each of the RMs as you do your work. The RM notes the TM from the transaction object.
4) Once the "commit now" is issued, all RMs would be expected to commit. If one cannot, it needs to do a recovery. There is no rollback at that point. Once the RM says, "yes I can commit," it has guaranteed that the transaction will commit. Any action to the contrary (such as, oops, the disk crashed and I cannot recover) indicates a bug in the RM.
5) I'm not sure. There are two different standards for XA TMs. JBoss Transactions follows one of them. Many RMs handle only the other. But there is one thing I do know. Is Tibco Server a Java service that can be deployed within JBossAS? If not, then JTA will not do the job. You will need JTS.
Have you looked at the JBoss Transactions documentation?