Requirements
We needs JTA complaint XA transaction manager since we have multiple resources
- Database - Mysql
- Cache - Infinispan
Both of these resources support XA - JTA transactions. - Mysql through com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.
Alternatives for transaction manager
- Atomikos - http://www.atomikos.com/
- Jboss TM - http://www.jboss.org/jbosstm
- Bitronix
We also need to choose a connection pool framework for database which is XA complaint. Hence options
- Atomikos connection pooling - http://www.atomikos.com/
- DBCP Connection Pooling - http://commons.apache.org/dbcp/
- Tomcat jdbc pool - http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html
Picking the right combination
- Atomokis transaction Manager + Atomikos connection pooling
- Easy configurations with Spring
- JTA implementation comes with connection Pooling & Datasource (no need of seperate JCA)
- Does support synchronization
- Does not support last resource optimization
2. Jboss transaction Manager
Jboss does not come with default connection pool or JCA to be used in Standalone mode. Hence it is ideal with server liek Jboss and not in standalone mode
Issues
1. Tried Jboss TM + DBCl Connection pool(XA) as suggested in - http://lafernando.com/2011/01/05/xa-transactions-with-apache-dbcp/
Faced issues were in connections got exhasted and where not returned to the pool
2. Then tried to replace DBCP with Tomcat jdbc pool - which is the advanced version of dbcp overcoming its drawbacks
Even though jdbc pool claims to have XA support , did not find much info about it in the net. When I tried the datasource did not seem to take part in the transaction.
The missing piece was the JCA - http://jbossts.blogspot.co.uk/2012/01/connecting-dots.html
So the optiosn for JCA where
- Jboss TransactionalDriver (Not suggested for production use) - http://www.javaworld.com/javaworld/jw-04-2007/jw-04-xa.html?page=1
- IronJacamar - http://www.jboss.org/ironjacamar
Both these did not have any great documentation for use in standalone environment.
Based on all the above we will switch back to Atomikos because
- It has Support
- Good documentation/ examples
- Seems to be widely used
No comments:
Post a Comment