timerbpmncamundaevent-gateway

BPMN event-based gateway with conditional flow


I am trying to model an event-based gateway that waits for several messages, and optionally for a timer. Before using this in a real model I tried it in a unit test, and it seems in the camunda engine the condition is completely ignored. Now I'm wondering if this is supposed to be supported by bpmn, if not if there is an easy alternative way to model this.

process model

The code for the unit test, based on the camunda-engine-unit-test project is as following:

Map<String, Object> variables = singletonMap("isTimerActive", (Object) false);
ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", variables);
assertFalse("Process instance should not be ended", pi.isEnded());

String id = pi.getProcessInstanceId();
Job timer = managementService.createJobQuery().processInstanceId(id).timers().active().singleResult();

assertNull(timer);

Solution

  • This is not allowed.

    The outgoing Sequence Flows of the Event Gateway MUST NOT have a conditionExpression

    BPMN 2.0 Specification Section 10.5.6, page 297

    edit: source: http://www.omg.org/spec/BPMN/2.0/PDF