Open Documentation Menu

Using timer events

For process modeling, you can use the BPMN item intermediate boundary event (attached intermediate event) of the Timer type. You can attach these intermediate events to user activities or services. When getting started with attached intermediate events, it is useful to create a simple process with one user activity first.

The BPMN model of this sample process is structured as follows:

<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" targetNamespace="" exporter="d.velop process modeler">
  <process id="timer_event_process" name="Timer Event Process" isExecutable="true">
    <startEvent id="start" />     
        <userTask id="task_hello_world" name="Hello World" camunda:candidateUsers="${variables.get('dv_initiator')}" />
    <sequenceFlow id="s1" sourceRef="start" targetRef="task_hello_world" />
    <sequenceFlow id="s2" sourceRef="task_hello_world" targetRef="end" />
  </process>
</definitions>

Adding an intermediate event

Add the BPMN item boundaryEvent to the process.

...
<process id="timer_event_process" name="Timer Event Process" isExecutable="true">
  ...
  <userTask ... />
  <boundaryEvent id="timer" attachedToRef="task_hello_world">
    <timerEventDefinition>
      <timeDuration>PT1M</timeDuration>
    </timerEventDefinition>
  </boundaryEvent>
  ...
</process>

Explanation of the properties

  • id:The property is used as a unique identifier for the send activity.

  • attachedToRef: The property defines which BPMN item this intermediate event should be attached to.

Explanation of the event definition:

  • timerEventDefinition: This BPMN item defines that the intermediate event is a time event

  • timeDuration: This BPMN item defines that it is a relative time span. In this case, a span of one minute has been defined. If you want to define an absolute point in time, you can use the BPMN item timeDate. In both cases, you need to enter the values in the ISO 8601 format. You can also determine the values from variables.

Adding an event path

If an intermediate event occurs in the process, the process follows a separate process path. You can e.g. configure a process in such a way that the process leads from an intermediate event directly to the end event. You insert this configuration into the process as follows:

...
<process id="timer_event_process" name="Timer Event Process" isExecutable="true">
  ...
  <sequenceFlow id="s3" sourceRef="timer" targetRef="end" />
</process>

In order for the BPMN diagram to be displayed correctly in the modeling tool as well as the user interface, diagram information has been added. The final BPMN definition looks as follows:

<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" targetNamespace="" exporter="d.velop process modeler">
  <process id="timer_event_process" name="Timer Event Process" isExecutable="true">
    <startEvent id="start" />
    <userTask id="task_hello_world" name="Hello World" camunda:candidateUsers="${variables.get('dv_initiator')}" />
    <boundaryEvent id="timer" attachedToRef="task_hello_world">
      <timerEventDefinition>
        <timeDuration>PT1M</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <endEvent id="end" />
    <sequenceFlow id="s1" sourceRef="start" targetRef="task_hello_world" />
    <sequenceFlow id="s2" sourceRef="task_hello_world" targetRef="end" />
    <sequenceFlow id="s3" sourceRef="timer" targetRef="end" />
  </process>
      
  <!-- Diagram information -->
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="timer_event_process">
      <bpmndi:BPMNShape id="start_di" bpmnElement="start">
        <dc:Bounds x="179" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="task_hello_world_di" bpmnElement="task_hello_world">
        <dc:Bounds x="290" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="timer_di" bpmnElement="timer">
        <dc:Bounds x="372" y="139" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="end_di" bpmnElement="end">
        <dc:Bounds x="462" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="s1_di" bpmnElement="s1">
        <di:waypoint x="215" y="117" />
        <di:waypoint x="290" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="s2_di" bpmnElement="s2">
        <di:waypoint x="390" y="117" />
        <di:waypoint x="462" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="s3_di" bpmnElement="s3">
        <di:waypoint x="408" y="157" />
        <di:waypoint x="480" y="157" />
        <di:waypoint x="480" y="135" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>