0 Replies Latest reply on Mar 23, 2017 12:22 AM by leon v

    JBPM 6.5 Final, ResumeProcessInstance will overwrite workitem parameters

    leon v Newbie

      The scenario is simple.

      We pass process parameters from 1 stage to the next.

      Each stage is a task performed by a java class implementing WorkItemHandler.

       

      At a validation stage we detect the parameters are missing some data, we redirect to a human task and suspend the process.

      This all works very nice, the process terminates nicely and we can correct the missing data OUTSIDE of jbpm screens.

       

      After days of digging I found the following way to resume the process, but I must be doing something wrong:

       

      ResumeProcessInstanceCommand susp = new ResumeProcessInstanceCommand();

        susp.setProcessInstanceId(processInstanceId);

        ksession.execute(susp);

        Map<String, Object> parameters = new HashMap<String, Object>();

       

       

        parameters.put("processVar1", "5555");

        paramsProcess1.put("txnWorkitemObjList", "2222222222");

        

      ksession.getWorkItemManager().completeWorkItem(workItemId, parameters);

      The good news: This does resume the workflow and continues to the next stage in the workflow.

      Bad news:

      1. the completeWorkItem requires workitemId!  This is an internal ID of JBPM, there is no API to get this value. The only way to get it is to search the database for the given processInstanceId and get the workitemId. There MUST be a better way ????

      2. The parameters passed to the completeWorkItem are overwritten with the values as it was when the task was suspended, You would expect that the completeWorkItem works exactly the same as when you call it from any other task.

      3. JBPM demands that the workitem is resumed by the SAME session! That works on 1 instance, but in a cluster with many nodes, it should be possible to resume a processinstance on any other session especially because the entire state of this processInstance is saved in the database.

       

      I've included the entire unit test, so it should be easy to reproduce.

      Just create a db.properties with your database parameters:

       

      db.jdbc.driver=oracle.jdbc.OracleDriver

      db.conn.uri=jdbc:oracle:thin???/???@host:1521:instance

       

      db.userid=user

      db.password=password

       

      Thanks for any feedback.

      Leon