close

Filter

loading table of contents...

Workflow Manual / Version 2110

Table Of Contents

4.1.11 Timers

Timers can be used to define time spans or moments in the execution of a workflow. For example, the time available for a user task to be accepted. The CoreMedia Workflow supports timers which can be initialized with relative (the timeout value is added to current time giving the expiration time) or absolute values.

By default, two timers are attached to UserTask definitions and one to the Process definition which can be set via the following attributes:

  • defaultTimeout: This is a relative timer which is activated when a process instance is started or a task instance is activated.

  • defaultOfferTimeout: This is a relative timer which is activated at the first offer of the task after the activation. This means if the task is first accepted by a user, then canceled by the user and again offered to the other users the timer will not be restarted. In contrast, if the task is used in a loop, the timer will be restarted each time the loop reaches this task.

If these timers expire, they will add a warning message to their process or task instance. You might use one of the predefined TimerHandlers (using the <TimerHandler> tag) to react differently if timers expire (see Section 4.4.3, “Predefined TimerHandler Classes”). The handler must be defined in the same location, that is the process or task definition, where its associated timer variable is defined.

In addition, you may define custom timers: At first you have to define a variable of type Timer. Using the attribute relative you can define whether the timer is a relative ("true") or absolute one ("false"). Defining an absolute value in the workflow definition might not make much sense, it is more useful in the client GUI.

The timer can be started and stopped using the actions EnableTimer and DisableTimer (see Section 4.4.1, “Predefined Action Classes”). Using the expressions IsExpired or IsEnabled, you can check whether your timer has been expired or is enabled and running.

Note that

  • Timer values have no identity, they are bound to their variables.

  • Aggregations of timers are not supported.

The following example shows an automated task which defines and enables a timer variable. The succeeding user task waits until the timer expires:

<AutomatedTask name="StartTimer" description="SimplyStart" 
  successor="Wait">
    <Variable name="waiting" type="Timer">
        <Timer value="100"/>
    </Variable>
    <Action class="EnableTimer" timerVariable="waiting"/>
</AutomatedTask>
<UserTask name="Wait" successor="Next">
    <Guard>
        <IsExpired variable="StartTimer.waiting">
    </Guard>
    <!-- Code -->
</UserTask>

Example 4.9. Example of a self-defined timer which expires after 100 seconds


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.