3 Replies Latest reply on Aug 10, 2005 7:25 PM by Rahul Dev

    Accessing JBoss Transaction Manager from external JBossCache

    Rahul Dev Newbie


      I have JBoss cache running on our home built scheduler and wanted to
      hook it up with the Transaction Manager in JBoss AS 4.0.2 so that any
      requests from/to my scheduler (which uses JBossCache) can be made within
      the same transaction context hence commit and rollback operations can be
      made possible in the cache as well.

      Can someone please guide me with, possibly a sample code? I have referred
      the documentation http://docs.jboss.com/jbcache/current/TreeCache/html/
      but it works with a DummyTransaction Manager, which is not to be used in
      a production server.


        • 1. Re: Accessing JBoss Transaction Manager from external JBossC
          Rahul Dev Newbie


          I think my last question was either a bit confusing or I was making the
          post in the wrong topic.

          To make it short, we are running JBoss cache inside our homebuilt
          scheduler and would want our scheduler, to be integrated with the
          transaction services that our applications run within JBoss 4.0.2.

          Which means: Our Stateful EJB usually does a few operations and needs to
          start a scheduled task in our homegrown scheduler. The scheduled task
          puts an entry in the JBossCache. The scheduler runs OUTSIDE the JBoss
          container and not inside it.

          In which case, as I understand, the transaction context must be
          propagated from the EJB -> JBossCache (which runs within the scheduler)
          Also, the instance of or JBCache must be hooked to the Transaction
          Manager (I am using the same transaction manager in JBoss 4.0.2).

          ALSO I do not plan to use JMS to integrate these 2 seperate systems, as it
          has its own performance overheads. Is there anyother way to propagate
          the transaction contect across the 2 seperate systems and hook
          JBossCache within the same context?

          Can someone PLEASE guide me in some direction as to how to do it OR
          update the relevent documentation, if possible, so that it can also help
          others who are trying the same?

          Your help in this regard would be MUCH appriciated.

          Thanks again.

          • 2. Re: Accessing JBoss Transaction Manager from external JBossC
            Ben Wang Master

            You can use JBossTransactionManagerLookup (which is default in the sample files, btw).

            But whoever calling JBossCache needs to have concept of transaction context as well.


            • 3. Re: Accessing JBoss Transaction Manager from external JBossC
              Rahul Dev Newbie

              Thanks ben for your response.

              JBoss AppServer would call JBossCache running on a different VM. We plan
              to use NIO to make our application running on JBoss talk to JBossCache
              running on the "other" VM for obvious performance benefits.

              Both VM instances could be talking to the same TM or differnet TM, it does not
              matter as long as BOTH TM support 2PC.

              The problem is how can I make JBossCache operation make aware of the
              transaction context on which the calling JBoss AS operation was made? (This
              is important for commit / rollback operations.)
              - OR -
              Would using the SAME TM solve the problem?