Wednesday, 23 December 2009

How To Send XA JMS Message On JBoss

It turns out that there is very little information about how to sending JMS messages as part of a JTA transaction using JMS API. Most examples on the web use false for parameter transacted in QueueConnection.createQueueSession(boolean transacted, int acknowledgeMode); in which case the message is sent directly and not at the commit of the JTA transaction.

So I was happy when I found Odi's article: JMS transactions with JTA in JBoss 4.

And from a quick look, there seems to be a lot of interesting developer content on Odi's site. Definitely worth a look.

At first sight, you might think that I'm just sharing this with the world to make it a better place. But actually I'm just adding this 1 link to google's pagerank so that I'll find it quicker next time I need it ;-)


  1. Actually the article is about sending messages in a transacted way that has nothing to do with XA. If you want to use XA, simply lookup the XAFactory, create an XASession (which does not provide the transactional options for obvious reasons) and that's it!
    Using standard (non-XA) Sessions is also not really potable between App-Servers.

  2. Anonymous, thanks! JMS apis are more twisted then I already thought. We're now checking how we can accomodate both XA and non-XA jms message sending.

  3. If you really want distributed transaction with other resources like JDBC, you have to lookup "java:/JmsXA" to get your ConnectionFactory. Other connection factories implements only "local" transaction.