0 Replies Latest reply on Jul 2, 2009 12:05 PM by Claudio Grasso

    Asynchronous continuations in Weblogic 10.x using MDB (jBPM

    Claudio Grasso Newbie

      After struggling for a few days with asynchronous continuations with the following configuration:

      Weblogic 10.3
      jBPM 3.3.1.GA

      we could finally make them work.

      Although we followed configuration instructions from the manual thoroughly, things didn't work as expected. The most weird thing was that the very same configuration worked fine in JBoss 4.2.3.GA. We finally detected that the problem was that the messages sent to JobListenerBean were not being commited. The reason for this is that JBoss and Weblogic handle Non-transacted JMS sessions within a JTA transaction just in the opposite way.

      For details please read:

      Weblogic
      http://e-docs.bea.com/wls/docs103/jms/trans.html#wp1025537

      and

      JBoss
      http://www.odi.ch/prog/jms-tx.php

      Unfortunately the kind of session (transacted vs. non-transacted) that jBPM uses is not configurable: it is hardcoded in JmsMessageService.java

       /*
       * If the connection supports XA, the session will always take part in the global transaction.
       * Otherwise the first parameter specifies whether message productions and consumptions
       * are part of a single transaction (TRUE) or performed immediately (FALSE).
       * Messages are never meant to be received before the database transaction commits,
       * hence the transacted is preferable.
       */
       session = connection.createSession(true, Session.SESSION_TRANSACTED);
      


      so we had to change that line to:


      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE) ;
      


      Let me emphasize that the change in the first parameter value (true -> false) is NOT meant to achieve different behaviors in both application servers. It's just that they both interpret it in the opposite way. (If you don't trust me read the above links :-) )

      Hope that this can save other people's time ;-)

      BTW: I don't know if future releases of jBPM are going to deal with asynchronous continuations in the same way, but if they are, it could be good idea to make this behavior configurable.

      Best regards,

      Claudio