cancel
Showing results for 
Search instead for 
Did you mean: 

Process does not end

mrb
Champ in-the-making
Champ in-the-making
Hey together,

i'm playing a little bit with activiti and i have a strange behaviour, when i'm using usertasks.
My process never ends and i don't know why.

My Process:
<?xml version="1.0" encoding="UTF-8"?><definitions>  <message id="newRequest" name="newRequest"></message>  <process id="myProcess" name="My process" isExecutable="true">    <startEvent id="messagestartevent1" name="workflow">      <messageEventDefinition messageRef="newRequest"></messageEventDefinition>    </startEvent>    <userTask id="Approval" name="Approval">      <extensionElements>        <activiti:taskListener event="create" class="AssignSupervisor"></activiti:taskListener>      </extensionElements>    </userTask>    <sequenceFlow id="flow1" sourceRef="messagestartevent1" targetRef="Approval"></sequenceFlow>    <endEvent id="endevent1" name="End">      <extensionElements>        <activiti:executionListener event="start" class="sendNotification"></activiti:executionListener>      </extensionElements>    </endEvent>    <sequenceFlow id="flow2" sourceRef="Approval" targetRef="endevent1"></sequenceFlow>  </process></definitions>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


ProcessInstance costInstance = runtimeService.startProcessInstanceByMessage("newRequest");      TaskService ts = processEngine.getTaskService();      List<Task> tasks = ts.createTaskQuery().taskAssignee("supervisor1").list();      assertEquals(1, tasks.size()); //true      ts.complete(tasks.get(0).getId());      System.out.println(costInstance.getActivityId()); //Approval      assertEquals(true, costInstance.isEnded()); //false‍‍‍‍‍‍‍‍‍


What i'm doing wrong?

Thanks a lot.
3 REPLIES 3

mrb
Champ in-the-making
Champ in-the-making
Thank you.

frederikherema1
Star Contributor
Star Contributor
Thanks @ollib for posting that link.

@mrb, keep in mind that the ProcessInstance object you get back is a snapshot from the time you queried the instance, this is right after you started it. All other operations (eg. completing a task) are not reflected on the processInstance object, unless queried again.

You can compare it with detatched entities in JPA…