1 Reply Latest reply on May 23, 2012 1:16 AM by devilkazuya99

    How to run through Human Task Locally

    devilkazuya99

      I have a process

      (start) ---> [Human Task 1] -----> [Human Task 2] ----> [Human Task 3] ----> (End)

       

      Here are the steps in my program.

      1. Starting the process is no problem

          ksession.startProcess("humanTaskFlow", params);

       

      2. Looking for the task is no problem too

          List<TaskSummary> taskSummaryList = localTaskService.getTasksAssignedAsPotentialOwner(actor, "en-UK");

       

      3. Starting the task is no problem

          localTaskService.start(taskSummary.getId(), actor);

       

      4. Completing the task is no problem

          localTaskService.complete(taskSummary.getId(), actor, contentData);

       

      2. Looking for next task GOT PROBLEM.

          List<TaskSummary> taskSummaryList = localTaskService.getTasksAssignedAsPotentialOwner(actor, "en-UK");

       

      5. Dispose knowledge session

       

      My logic is like this:

      step 1

      while(has_more_task) {

           step 2

           step 3

           step 4

      }

      step 5

       

      The result is [Human Task 1] started and completed. Then the program jump to step 5 and exit. But when I check the database, [Human Task 2] was created and at 'Reserved' state.

       

      I changed my logic to:

      step 1

      while(has_more_task) {

           step 2

           step 3

           step 4

           Thread.sleep(1000);

      }

      step 5

       

      and I can run through all the Human Tasks.

      Am I doing something very stupid here???

        • 1. Re: How to run through Human Task
          devilkazuya99

          I found my problem. The previous code I uploaded was still using Mina Service. I did modification below so to use LocalTaskService. Now it is working, no need to Thread.sleep(1000) any more.

           

                         TaskService localTaskService = new LocalTaskService(taskSession);
                         SyncWSHumanTaskHandler syncWSHumanTaskHandler = new SyncWSHumanTaskHandler(localTaskService, ksession);
                         syncWSHumanTaskHandler.setLocal(true);
                         syncWSHumanTaskHandler.setClient(localTaskService);