Custom Search



I’ve been working a bit on some Java based transaction programming lately and it’s a pretty cool experience. I should have known about this in the past since it is quite a cool way of handling transaction validity in your application. This is especially very useful for 2 Phase Commit (2PC) transactions as such in the case of  synchronizing data between a database and a JMS server or broker.

In my case, I’ve used Oracle XE (Express Edition) for my DB server on the test environment, as well as IBM WebSphere MQ for my messaging or JMS server. The core component I’ve used for my JTA transaction manager is Atomikos which just recently open sourced its Atomikos Transaction Essentials product line. Integrating all these components are very easy since they all support XA resources and provide XA enabled APIs for use on your application.

Atomikos offers some very useful wrappers for XA resources such as the SimpleDataSourceBean which you can make use for your XA enabled JDBC classes, and also a NonXADataSource wrapper class if you want to use a non-XA enabled database driver. Sad to say, Atomikos doesn’t have a wrapper for non-XA JMS API or classes, so if you want to make use of Atomikos for your JMS transactions, it’s a must that it has support for XA resources.

I definitely like the idea of an all or nothing transaction, which means that if either the DB or JMS transaction fails then a transaction rollback occurs, and if they both succeed then that’s the only time a commit sequence would push through. Moreover, even if a commit sequence has started but one of the transaction fails to commit such as in the case of a server crash or timeout, then a rollback is called again or in some cases a heuristic exception is thrown. This is most useful for crucial application such as the of what’s used on financial transactions in which the validity of data is of utmost importance.

Right now, I’m really enjoying this java based transaction programming stuffs and I still have a lot of things to learn. Well, competence is built with time and effort anyway. ;)

[tags]Oracle DB, Oracle XE, Atomikos, IBM WebSphere MQ, JMS, JDBC, Java Transaction API, Java Messaging Services, Two Phase Commit Transactions[/tags]

Popularity: 4% [?]

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes