AnsweredAssumed Answered

How to execute 2 tasks in parallel in Activiti

Question asked by chandanmb1 on Sep 21, 2016
Hello team,

I have a sample workflow which looks like below

                                              ———-UserTask2    —–

     Start —-> UserTask1—-                                                      —  UserTask4—— End

                                             ———- UserTask3   ——


UserTask2 and UserTask3 is a parallel task. Once i start the activiti, i will check the ACT_RU_TASK table, i am checking the current activiti and executing my business logic. <blockcode>(I have not used any of UserTaskListener )</blockcode>. Based on ActivitiName, i am calling my desired classname and executing business logic. Once my business logic execution is completed, i am making the task complete.

Again i was checking the current task and process continues. This was working for sequential task. But i have a parallel task now. How to handle it. Does it has 2 entries in ACT_RU_TASK table, once UserTask1 is completed like
  TASK002    USERTASK2   PID001
  TASK003    USERTASK3   PID002


//fetch current task
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(processInstanceId));
List<Task> currentTask = taskQuery.list();



//complete task

public void completeTask(String processInstanceId ) {
      Task currentTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
      if(currentTask!=null){
         taskService.complete(currentTask.getId());
      }
      
   }


Please provide me the approach. I am not using the TaskListener interface.

Regards,
Chandan

Outcomes