1 Reply Latest reply on Jun 4, 2003 9:00 PM by Adrian Brock

    Need help on distributed transaction

    delboypass Newbie

      I have messages stored on a local machine on a queue.
      When a scheduler is called it will start receiving those messages and attempt to deliver them to a remote queue.
      This is not the greatest solution as fails to meet many of the ACID tests.
      So how do you start a transaction so the reading of the message and the writing of the message are contained as one atomic unit of work.
      I read around and understand that this is normally dealt with by JTA XA and in JBoss you need to evoke a different connection factory java/jmsXA but is there any documentation or a readme that takes you through it?
      or does anybody have any examples of the above - reading local message and writing remotely in a rollback transaction or a double commit.
      Cheers del.

        • 1. Re: Need help on distributed transaction
          Adrian Brock Master

          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
          at restart.