All that is required is that you enlist the XAResources
of the XASessions in the same transaction.
java:/JmsXA will do this for you but it uses
in the invm connection factory java:/XAConnectionFactory.
You are supposed to able to use this
connector with other connection factories,
but I haven't tried it. It would require
changing the rar deployment.
You can also do it yourself, something like:
InitialContext ctx = new InitialContext();
TransactionManager tm = (TransactionManager) ctx.lookup("java:/TransactionManager");
Transaction tx =tm.getTransaction();
It isn't for the faint hearted though.
You should read the specs carefully.
You should also be aware that jbossmq doesn't
fully support recovery. If the machine crashes
after the prepare but before the commit
suceeds, the local branch will be rolled back