cancel
Showing results for 
Search instead for 
Did you mean: 

Boundary Event on SubProcess Not Firing

puja
Champ in-the-making
Champ in-the-making

Hi,

Please provide answers for below queries -

1. I have a sub process named "Document Approval Sub Process" with activities (Start -> Approve LC Docs User Task -> Collect Approval Status -> End). Timer event is attached to this sub process and the same is not getting fired. Please let me know what's going wrong.

2. After specified time, approval process is to be escalated to escalation group (have another sub process to handle escalation "Escalation - Document Approval Sub Process" with activities (Start -> Escalation - Approve LC Docs User Task -> Escalation - Collect Approval Status -> End)). Is it possible not to cancel first sub process and both sub process remain active in case timer reached specified time? Also if any user (using user task from first sub process) or any user (using user task from escalation sub process) approves or rejects, the process can be completed successfully.

3. Also not able to design the process flow using Activiti Explorer as getting Null Pointer Exception when using timer boundary event. We need to show process diagram with current status being highlighted. The same was able to do till the time timer event was not introduced in process flow. But with timer event, how to decide co-ordinates for respective BPMNDI elements.


Uploaded BPM Process File and Activiti-Config XML files.

15 REPLIES 15

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Is it possible not to cancel first sub process
yes

<boundaryEvent id="boundaryTimer" cancelActivity="true"….

and both sub process remain active in case timer reached specified time?
In that case you do not cancel Activity (false)

Also if any user (using user task from first sub process) or any user (using user task from escalation sub process) approves or rejects, the process can be completed successfully.
I would say to use messages (or signals), after the task complete to notify subprocess about the execution state.

Also not able to design the process flow using Activiti Explorer…
I can not answer.

Regards
Martin

puja
Champ in-the-making
Champ in-the-making
Hi Martin,

Timer event is not getting fired for escalation.bpmn20.xml process. Could you please help me out on this by letting me know what is wrong?

I would say to use messages (or signals), after the task complete to notify subprocess about the execution state.
[Puja] Please help me out with an example.

Thanks,
Puja

puja
Champ in-the-making
Champ in-the-making
Hi,

The timer boundary event on a multi instance sub process is not firing. Is this an issue with Activiti? Please help me out on this. The config file and bpm process are attached above. What is the alternative to achieve the same?

Thanks,
Puja

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Puja,

I have found similar jUnit test in activiti project

  @Deployment
  public void testParallelSubProcessWithTimer() {
    String procId = runtimeService.startProcessInstanceByKey("miParallelSubprocessWithTimer").getId();
    List<Task> tasks = taskService.createTaskQuery().list();
    assertEquals(6, tasks.size());
   
    // Complete two tasks
    taskService.complete(tasks.get(0).getId());
    taskService.complete(tasks.get(1).getId());
   
    // Fire timer
    Job timer = managementService.createJobQuery().singleResult();
    managementService.executeJob(timer.getId());
   
    Task taskAfterTimer = taskService.createTaskQuery().singleResult();
    assertEquals("taskAfterTimer", taskAfterTimer.getTaskDefinitionKey());
    taskService.complete(taskAfterTimer.getId());
   
    assertProcessEnded(procId);
  }


<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definition"
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:activiti="http://activiti.org/bpmn"
  targetNamespace="Examples">
 
  <process id="miParallelSubprocessWithTimer">
 
    <startEvent id="theStart" />
    <sequenceFlow id="flow1" sourceRef="theStart" targetRef="miSubProcess" />
   
    <subProcess id="miSubProcess">
      <multiInstanceLoopCharacteristics isSequential="false">
        <loopCardinality>3</loopCardinality>
      </multiInstanceLoopCharacteristics>
     
      <startEvent id="subProcessStart" />
      <sequenceFlow id="subFlow1" sourceRef="subProcessStart" targetRef="subProcessFork" />
     
      <parallelGateway id="subProcessFork" />
      <sequenceFlow id="subFlow2" sourceRef="subProcessFork" targetRef="subProcessTask1" />
      <sequenceFlow id="subFlow3" sourceRef="subProcessFork" targetRef="subProcessTask2" />
     
      <userTask id="subProcessTask1" name="task one" />
      <sequenceFlow id="subFlow4" sourceRef="subProcessTask1" targetRef="subProcessEnd1" />
      <endEvent id="subProcessEnd1" /> 
     
      <userTask id="subProcessTask2" name="task two" />
      <sequenceFlow id="subFlow5" sourceRef="subProcessTask2" targetRef="subProcessEnd2" />
      <endEvent id="subProcessEnd2" /> 
     
    </subProcess>
   
    <boundaryEvent id="timer" attachedToRef="miSubProcess">
      <timerEventDefinition>
        <timeDuration>PT1H</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <sequenceFlow id="flow3" sourceRef="timer" targetRef="taskAfterTimer" />
    <userTask id="taskAfterTimer" />
   
    <sequenceFlow id="flow4" sourceRef="miSubProcess" targetRef="theEnd" />
    <endEvent id="theEnd" />
   
  </process>

</definitions>

Regards
Martin

puja
Champ in-the-making
Champ in-the-making
Thanks Martin.

The JUnit works fine.

But if I deploy this process and start the same. After specified time the timer is not getting fired on its own. Please help me out on the same.

Regards,
Puja

martin_grofcik
Confirmed Champ
Confirmed Champ
Did you set processEngineConfiguration's jobExecutorActivate property  to true?

    <property name="jobExecutorActivate" value="true" />

Regards
Martin

puja
Champ in-the-making
Champ in-the-making
Hi,

Yes, I have set processEngineConfiguration's jobExecutorActivate property to true.

Regards,
Puja

martin_grofcik
Confirmed Champ
Confirmed Champ
Puja,

could you create your own jUnit test for it please?
(http://forums.activiti.org/content/sticky-how-write-unit-test)

Regards
Martin

puja
Champ in-the-making
Champ in-the-making
Hi Martin,

I have performed below JUnit -

@Deployment
  public void testParallelSubProcessWithTimer() {
    String procId = runtimeService.startProcessInstanceByKey("miParallelSubprocessWithTimer").getId();
    List<Task> tasks = taskService.createTaskQuery().list();
    assertEquals(6, tasks.size());

    // Complete two tasks
    taskService.complete(tasks.get(0).getId());
    taskService.complete(tasks.get(1).getId());

  }

After that -

1. I waited for 1 hour.
2. Went and checked ACT_RU_TASK table in DB. This table still had remaining 4 tasks. These were not terminated.
3. ACT_RU_JOB table still had the record.

In short, the job entry didn't trigger the timer end event (to terminate remaining 4 tasks and to create the task after timer).

Regards,
Puja