1 Reply Latest reply on Feb 24, 2006 6:14 PM by ralfoeldi

    CMT and jBpm

    elvioandrade

      Hi,

      I don't have mutch experience using jBpm and I would like to hear your expertise in order to clarify some doubts that I have.

      First I will give a brief explanation of the scenario.

      - I have a session bean that is responsable to handle requests and to start workflow processes.
      - These requests are performed by other sessions beans.
      - The workflow process has several nodes that have ActionHandlers assigned to them in order to perform some logic.
      - These handlers are of two types:
      - Perform actions on local session beans.
      - Perform remote calls to exterior components/systems using rmi or
      soap.

      Basically i have this:

      1.SessionBean1 calls WorkflowSB
      2.WorkflowSB creates and starts a workflow process
      3.Workflow execution reaches a node and executes an action.
      4.ActionHandler performs a call to SessionBean2

      If using CMT, do I have the guaranty that SessionBean1 and 2 will run inside the same transaction if both of them configured to REQUIRED?

      Another question that I have is that I want to be able to persist the workflow execution, I want to do it in all actions, after each action logic is executed, by specifying a begin-end Transaction only for the saveProcessInstance call. I will have like this in my action handler:

      public void execute(ExecutionContext ctx)
      {
       this.doActionLogic(ctx);
       this.saveProcess();
      }
      
      void doActionLogic()
      {
       // this is where the action handler logic is performed
       // local session bean invocation or remote call using rmi or soap
      }
      
      void saveProcess(ExecutionContext ctx)
      {
       ProcessInstance processInstance = ctx.getProcessInstance();
      
       JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession();
      
       jbpmSession.beginTransaction();
      
       GraphSession graphSession = jbpmSession.getGraphSession();
      
       graphSession.saveProcessInstance(processInstance);
      
       jbpmSession.commitTransaction();
      
       jbpmSession.close();
      
      }
      


      Will this transaction be independent from the sessionbean1 transaction?

      thanks
      Élvio



        • 1. Re: CMT and jBpm
          ralfoeldi

          Hi Elvio,

          this isn't a jBPM question, is it?

          Short answers:

          - yes (REQUIRED => same tx)
          - no (Hibernate tx = the general tx)

          If you read your question you will notice that you are asking for conflicting behaviour. All in one tx but persistence in another tx. It just doesn't work that way.

          A bit tight lipped today (This topic has been discussed in verrry long threads here.)