3 Replies Latest reply on Mar 30, 2010 5:55 PM by Ilya Dyoshin

    Commit transaction within web-service request

    Christoph Stüber Newbie
      Hello SEAM community,

      I want to create a Web-Service that is linked to a MDB that processes some kind of Jobs. The flow is as follows:

      1: Incoming Web-Service Request
      2: Create new Job-Object and call persist+flush
      3: Send JobID to Message Bean
      4: Message Bean reads Job object and does some processing in another thread
      5: Wait until Message Bean has completed
      6: Return result to Web-Service consumer and end Request.

      Now I have a problem, as in step 2 the newly created does not get written in the DB even though I use persist and flush. The message bean in step 4 will not be able to read it. The transaction will not be committed until the end of the request. I tried the following to solve this problem:


      after creating the Job Object. It actually works but afterwards SEAM seams to be broken as it expects to have a transaction. Even when I recreate a new transaction with:


      SEAM notices that I tampered with it. Is there any nice and clean way to commit a transaction before a request ends? Possibly without completely shutting down SEAMs global transaction handling?

      Thank you for any help in advance,