1 Reply Latest reply on Jul 24, 2003 3:35 AM by Bernd Zeitler

    Using a transactional JMS service

    hannwei Newbie


      Sorry if my questions sound too basic. I read the JBoss 304 document, but am not able to conclude whether or not the JMS service in JBoss 3.x is transactional. What I would like to achieve is this:

      - Some data is received through a server socket somewhere.
      - A session bean processes the data, updates an entity bean and sends an output object through JMS to a certain topic. The transaction starts when the session bean method is invoked, and ends when JMS receives the output object.
      - An pool of MDBs are configured to listen to that topic.
      - One of the MDBs receives the data, then uses the data to invoke some session bean methods, which in turn update some entity beans, and finally sends an output object to another JMS topic. The transaction here begins when the MDB receives the data and ends when the output object is sent to another JMS topic. If this transaction is rolled-back, I expect the JMS to resend the data to one of the MDBs again in a short while. There should be infinite retries, or the maximum number of retries should be configurable. Even after a restart of JBoss, the JMS is also expected to continue its retries.
      - Since there are a pool of MDBs that listen to one topic, each MDB in the pool should process data concurrently in different threads.
      - A piece of data should never be received by more than one MDB in the pool, unless it is a retry.

      I am trying to determine if the JMS service is transactional and is able to do the above things. If it is, then I probably will not have to implement a tuple-space-like or message-queue-like stuff using entity beans and UserTransaction of JBoss. Can anyone answer these questions?

      Will truly appreciate your help.

      Hann Wei

        • 1. Re: Using a transactional JMS service
          Bernd Zeitler Expert

          You can do all above with JBoss and JBossMQ, the JMS implementation of JBoss using CMT. I suggest you should use a late stable version of JBoss (or 3.2.2).

          -comit sending transacted with SB
          -acknowle receiving, comit sending and other transactional stuff with mdb (and SB involved if you want to)
          -resending, concurrent access and all the rest is normal mdb behaviour or configuration

          Depending on your configuration (persistent store for jms and other used datasources) you have to use xa transactions and you have to configure all resources enclosed in your transaction as managed resources in your deployment descriptors.

          I have seen an example with the free JBoss doko some time ago with managed resources.