17 Adding Delays, Deadlines, and Time Based Cycles to Your Process

This chapter describes how to use timer events to add time conditions to your BPMN process. It describes how to use the different timer events to add delays and deadlines, and to run additional activities.

This chapter includes the following sections:

17.1 Introduction to Timer Events

Timer events enable you to control the flow of your process using a time condition.

You can use timer events for:

  • Creating a delay before running an activity

  • Configuring a deadline for an activity

  • Configuring a deadline for a process

  • Triggering additional activities after an elapsed time

  • Start a process

  • Trigger a process periodically

Timer events are not based on the business calendar definitions.

Oracle BPM enables you to configure timers using:

  • A specific date and time

    You can configure a timer event to fire on a certain date. You can specify a specific date or use a function to calculate the it.

  • A relative time

    You can configure a timer event to fire after an elapsed time. You can specify the elapsed time or use a function to calculate it. If the timer event is a start event or a non-interrupting boundary event, then it fires multiple times.

When you define a timer event as a boundary event you can choose to configure it as interrupting or non-interrupting.

When an interrupting timer event fires, the token leaves the main process flow to follow the flow the timer defines. The flow an interrupting event defines, can resume the main process flow

When an non-interrupting event fires, the BPMN Service Engine creates a copy of the token that is running the main process flow and routes that copy through the flow the timer event defines. The flow a non-interrupting event defines cannot resume the main process flow.

17.2 Adding a Delay to the Process Flow

You can add a delay to the process flow by adding an intermediate timer catch event. When the token arrives to the timer event it waits the time specified in the timer event before moving to the next activity in the process.

For example, in a process that updates multiple data bases you might want to add a timer activity that delays the process a few minutes, to ensure that all databases are updated when the process continues.

You can configure the intermediate timer catch event to wait until a specific date or to wait for a certain period. In both cases you can choose to use a fixed value or to use an expression that specifies the corresponding date or interval.

When you configure a timer intermediate event as a cycle, the timer event only runs one time. It waits until the specified interval passes and then the token continues moving through the rest of the process flow.

Figure 17-1 Delaying the Process Flow

Description of Figure 17-1 follows
Description of "Figure 17-1 Delaying the Process Flow"

17.2.1 How to Add a Delay to the Process Flow

You can add a delay between to flow objects.

To create a delay until a specified date in the process flow:

  1. Locate the point in your process where you want to add the delay.

  2. From the Component Palette, from the Catch Events section, select Timer.

  3. Drop the timer event in the point where you want to add the delay.

  4. If you want to delay the process until a specific date, then you must configure the timer event as time date. If you want to delay the process for a certain period, then you must configure the timer start event as cycle.

    See Section 17.7.1, "How to Configure a Timer Event To Use a Specific Date and Time" for more information on how to configure a timer event as time date.

    See Section 17.7.3, "How to Configure a Timer Event to Use an Interval" for more information on how to configure a timer event as cycle.

17.2.2 What Happens When You Add a Delay to the Process Flow

A token that arrives to the intermediate timer event remains in the timer event until the time specified by the timer event arrives. If you configure the timer event to use a date, then the token remains in the timer event until the specified date. If you configure the timer event to use a cycle, then the token remains in the timer event until the specified time passes.

17.3 Designing a Process to Start Based on a Time Condition

You can add a timer start event to your process to configure it to be triggered based on a time condition. When the time condition specified in the timer start event evaluates to true, the BPMN Service Engine creates a new instance in the process.

For example, in a process to report working hours you can add a timer start event that creates an instance in the process one time a day.

You can configure your process to start on a specific date or to periodically create an instance. In both cases you can choose to use a fixed value or to use an expression that specifies the corresponding date or interval

When deploying a process containing a timer start event specifying a past date, the BPMN Service Engine automatically creates an instance of the process.

Figure 17-2 Starting a Process Based on a Time Condition

Description of Figure 17-2 follows
Description of "Figure 17-2 Starting a Process Based on a Time Condition"

17.3.1 How to Design a Process to Start Based on a Time Condition

You can design your process to start when a specific date arrives or to periodically start after a certain elapsed time.

To design a process to start based on a time condition:

  1. Open the BPMN process.

  2. If you want your process to have a single start event, then you must right-click the start event and select Change Trigger Type and then Timer.

    If you want your process to have multiple start events, then you must select a timer start event from the Start Events section in the Component Palette. Drop the timer start event on you process. Right-click the timer start event and select Properties.

  3. If you want the process to start on a specific date, then you must configure the timer start event as time date. If you want the process to start after a certain period, then you must configure the timer start event as cycle.

    See Section 17.7.1, "How to Configure a Timer Event To Use a Specific Date and Time" for more information on how to configure a timer event as time date.

    See Section 17.7.3, "How to Configure a Timer Event to Use an Interval" for more information on how to configure a timer event as cycle.

17.3.2 What Happens When You Design a Process to Start Based on a Time Condition

The BPMN Service Engine creates an instance in the process each time the time condition in the timer start event evaluates to true. If you configure the timer start event to use a specific date, then the BPMN Service Engine creates an instance when the specified date arrives. If you configure the timer start event to use a cycle, then the BPMN Service Engine periodically creates an instance in the process.

17.4 Configuring a Deadline for an Activity

You can configure a deadline for an activity using an interrupting timer catch event configured as a boundary interrupting event that leads to another point of the process. If the token remains in the activity for longer than expected or beyond a certain date, then the timer catch event gets triggered and interrupts the process flow.

You can configure the deadline to happen on a specific date, or after the token spends a certain time in the activity. In both cases you can specify a fixed date or interval or an expression that calculates the corresponding date or interval.

For example, in an purchase order process, you might want to configure the activity that gets the credit card approval to wait the approval for a day. And if the approval takes longer, then direct the token to an activity that sends a message to the customer.

Figure 17-3 Activity Deadline

Description of Figure 17-3 follows
Description of "Figure 17-3 Activity Deadline"

17.4.1 How to Configure a Deadline for an Activity

You can configure a deadline for an activity so that the token moves to another activity after the deadline expires. You can specify to which activity the token moves after the deadline expires.

To configure a deadline for an activity:

  1. Locate the activity in your process for which you want to configure a deadline.

  2. From the Component Palette, from the Catch Events section, select Timer.

  3. Drop the timer event over the activity.

    The timer event becomes a boundary event. A sequence flow coming out from the boundary timer catch event appears.

  4. Place the cursor over an end event and click to drop the sequence flow there.

  5. If you want the deadline to happen on a specific date, then you must configure the boundary timer catch event as time date. If you want the deadline to happen after a certain period, then you must configure the boundary timer catch event as cycle.

    See Section 17.7.1, "How to Configure a Timer Event To Use a Specific Date and Time" for more information on how to configure a timer event as time date.

    See Section 17.7.3, "How to Configure a Timer Event to Use an Interval" for more information on how to configure a timer event as cycle.

  6. In the Implementation tab, in the Timer Properties dialog, select Interrupting Event.

17.4.2 What Happens When You Configure a Deadline for an Activity

If the activity is still running when the timer event fires, then the token quits the activity and move to a different point in the process. The timer event fires because a certain date arrives or because the specified period passes, depending on how you configured the timer event.

17.5 Configuring a Deadline for a BPMN Process

You can configure a process deadline for your process using an event subprocess that starts with an interrupting timer start. After a certain time passes or a date arrives, the timer event fires. If the token is still in the process then it moves to the event subprocess.

The timer event is only active while the token remains in the process.

You can configure the deadline to happen on a specific date, or after the token spends a certain time in the activity. In both cases you can specify a fixed date or interval or an expression that calculates the corresponding date or interval.

For example, in a purchase order process, you can configure the process so that if the token stays in the process for more than three months, then it automatically ends the process.

You might want to use an error end event in the event subprocess, so that the process does not finish running successfully.

Figure 17-4 Process Deadline

Description of Figure 17-4 follows
Description of "Figure 17-4 Process Deadline"

17.5.1 How to Configure a Deadline for a BPMN Process

You can configure a deadline for a BPMN process. You can choose to terminate the process flow or to run a group of flow object when the deadline expires.

To configure a deadline for a BPMN process:

  1. Open the BPMN process.

  2. From the Component Palette, from the Activities section, select Event Subprocess.

  3. Drop the event subprocess in the process.

  4. Configure the start event in the event subprocess to be a timer event:

    1. Right-click the start event in the event subprocess.

    2. Select Properties.

    3. Click the Implementation tab.

    4. From the Implementation Type list, select Timer.

    5. Select Interrupting Event.

    6. If you want the deadline to happen on a specific date, then you must configure the timer event as time date. If you want the deadline to happen after a certain period, then you must configure the timer event as cycle.

      See Section 17.7.1, "How to Configure a Timer Event To Use a Specific Date and Time" for more information on how to configure a timer event as time date.

      See Section 17.7.3, "How to Configure a Timer Event to Use an Interval" for more information on how to configure a timer event as cycle.

17.5.2 What Happens When You Configure a Deadline for a BPMN Process

If the token stays in the process longer than specified by the interrupting timer event, then the timer event fires. When the timer start event in the event subprocess fires the token leaves the process and moves to the event subprocess.

17.6 Running Additional Activities

While running an activity or a process you can run additional activities based on a time condition. You can choose to trigger the additional activities periodically or on a certain date.

Typically you run additional activities when the activity you are currently running takes a long time to finish. For example, if you run a service that takes twenty hours to update a database, then you might want to send an e-mail to inform progress of the update to the interested parties.

The timer event is only active while the token remains in the activity.

You can also run additional activities while a process is running. These activities run in parallel to the main process flow.

Figure 17-5 Running Additional Activities While an Activity is Running

Description of Figure 17-5 follows
Description of "Figure 17-5 Running Additional Activities While an Activity is Running"

17.6.1 How to Run Additional Activities While an Activity is Running

You can run a parallel process flow while an activity is running. Generally you design a parallel process flow to trigger after a certain time when you know that the main activity might take long to complete.

To run additional activities while an activity is running:

  1. Locate the activity to run in parallel to the additional activities.

  2. Create an additional process flow by adding activities connected by sequence flows, outside the main process flow.

  3. Add a timer event as a boundary to the activity.

    A sequence flow for you to connect to an activity appears.

  4. Connect the sequence flow to the additional process flow you created.

17.6.2 What Happens When You Run Additional Activities While an Activity is Running

If the token is still in the activity when the non-interrupting fires, then the BPMN Service Engine creates a copy of that token and routes it through the flow that the timer event defines. The timer might fire multiple times while the activity in the main process flow is running.

17.6.3 How to Run Additional Activities While a Process is Running

You can run additional activities while the main process flow is running. Generally you design a parallel process flow to trigger after a certain time when you know your process might take long to complete.

To run additional activities while a process is running:

  1. Add a subprocess event to your process.

  2. Right-click the start event in the subprocess event.

  3. Select Properties.

  4. Click the Implementation tab.

  5. From the Implementation Type list, select Timer.

  6. Verify that the Interrupting Event option is not selected.

  7. If you want the additional activities to run on a specific date, then you must configure the timer event as time date. If you want the additional activities to run periodically, then you must configure the timer event as cycle.

    See Section 17.7.1, "How to Configure a Timer Event To Use a Specific Date and Time" for more information on how to configure a timer event as time date.

    See Section 17.7.3, "How to Configure a Timer Event to Use an Interval" for more information on how to configure a timer event as cycle.

  8. Add the additional activities to the subprocess event.

17.6.4 What Happens When You Run Additional Activities While a Process is Running

When the timer start event in the event subprocess fires, the BPMN Service Engine creates a copy of the token in the main process flow. The copy of the token in the main process flow follows the additional process flow the subprocess event defines. The timer start event may fire multiple times while the main process flow is running.

17.7 Configuring Timer Events

You can configure timer event to fire on a specific date and time, or to fire after a certain time passes. In both cases you can choose to provide a fixed time value or an expression that calculates it.

You can also configure a timer event to run periodically. The different supported granularities are daily, weekly and monthly. In all these cases you can configure the timer event to calculate the dates using the calendar rules defined for that project and to reschedule any event that matches a holiday.

17.7.1 How to Configure a Timer Event To Use a Specific Date and Time

You can configure a timer event to use a specific date and time. You can provide the date and time or use an expression to calculate it.

To configure a timer event to use a specific date and time:

  1. Right-click the timer event.

  2. Select Properties.

  3. Click the Implementation tab.

  4. Select Time Date.

  5. Provide a date.

    The following options are available to provide a date:

    Note:

    The date and time you specify correspond to the time zone the BPMN Service Engine uses.

  6. Click OK.

17.7.2 What Happens When You Configure a Timer Event to Use a Specific Date and Time

The timer event fires on the specified date and time. If you used an expression to specify the date and time, then the engine evaluates this expression to determine when to fire the timer event.

17.7.3 How to Configure a Timer Event to Use an Interval

You can configure a timer event to use an interval. You can specify the interval or use an expression to calculate it.

To configure a timer event to use an interval:

  1. Right-click the timer event.

  2. Select Properties.

  3. Click the Implementation tab.

  4. Select Cycle.

  5. Provide a time interval or select Use Expression and write an expression that returns an Interval.

    See Section 24.4, "Writing Expressions in Timer Events" for more information

  6. Click OK.

17.7.4 What Happens When You Configure a Timer Event to Use an Interval

The timer event fires periodically, waiting the time the interval specifies. If the timer event is a start event or a non-interrupting boundary event, then it fires multiple times. If the timer event is an intermediate timer event or an interrupting boundary event, then it waits for the specified interval before firing, but it fires only one time.

17.7.5 How to Configure a Timer Event to Run Periodically

You can configure a timer event to run daily, weekly or monthly at one or more specified times. You can also configure it to schedule the event using the calendar rules defined for the organization and to use a specified policy for rescheduling the event in case it falls on a holiday our outside the work schedule.

To configure a timer event to run periodically:

  1. Right-click the timer event.

  2. Select Properties.

  3. Click the Implementation tab.

  4. Select Time Schedule.

  5. Select the tab that corresponds to the period you want to define.

    The available options are:

    • Daily

    • Weekly

    • Monthly

  6. Click the Add button to specify the exact time the event happens.

    You may configure the event to run multiple times during a day, a week or a month.

    Table 17-1 shows how to specify the time according to the period you selected.

    Table 17-1 Time Definition According to Selected Period

    Selected Period Time Definition

    Daily

    You must define the hour of the day.

    Weekly

    You must specify the days of the week and the hour.

    Monthly

    You must specify the month, the week, the day and the hour.

    To configure the event to run on a specific day of the month, select Day of Month in the Week column and the Day column allows you to specify the day of the month.

    To configure an event to run every month, select All in the Month column.


  7. Aditionally you can configure the following optional settings:

    • Run from: enables you to define the date and time for the event to start running.

    • Run to: enables you to define the date and time for the event to stop running.

    • Repetitions: enables you to define the number of times the event runs. After the event runs the number of times you defined, it stops running.

    • Use Calendar Rules: specifies that the event runs based on the calendar rules defined for the organization.

      If you select this option, then you must define how to reschedule the event in case it is schedule to run on a holiday or outside the work schedule. The available rescheduling options are:

      Rescheduling Option Description

      No Reschedule

      The event does not run and it is not rescheduled.

      As soon as possible

      The event is rescheduled for the next available working hour.

      As soon as possible but at the same hour

      The event is rescheduled for the next availale working day at the same time


  8. Click OK.