AnsweredAssumed Answered

Intermediate Catching/Throwing Events

Question asked by egore911 on Dec 7, 2010
Latest reply on Dec 2, 2014 by lsmall
Right now I'm trying to model the possibility to terminate a process after a given amount of time has passed (i.e. "if the process did not terminate normally withing x hours -> terminate it"). So I've been looking at the Signavio Modeler which now allows to select the subset of BPMN that is supported by Activiti (as far as I understand). This is a great feature. But since intermediate events are missing in that list I'm wondering how I could react to a timer. Is that possible programmatically? Or is it just missing in the editor and supported anyway? Or is this functionality missing and will follow in 5.1 (or later).

Same goes for the "Terminate End Event". Right now it seems to be missing in the editor but is it supported? I think implementing could be rather easy. From my understanding of the code it might work like the following:


  private void terminateExecution(ExecutionImpl execution) {
    for (ExecutionImpl e : execution.getExecutions()) {
      terminateExecution(e);
    }
    terminateExecution(execution.getSubProcessInstance());
    execution.end();
  }

  ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult();
  ExecutionEntity executionEntity = (ExecutionEntity) processInstance;
  for (ExecutionImpl e : executionEntity.getExecutions()) {
    terminateExecution(e);
  }

This way all executions belonging to the process instance will get terminated (which is what I need the terminate event to do). I'm currently thinking about putting this code into a user task but ending the process the user task belongs to does not sound to be right :-) Is there another way to do this properly?

Outcomes