| Modeling and Implementation Guide for Oracle Business Process Management |
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:
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
Timer events are not based on the business calendar definitions.
Oracle BPM enables you to configure timers using:
A specific date and time
A relative time
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.
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.
To create a delay until a specified date in the process flow:
Locate the point in your process where you want to add the delay.
From the Component Palette, from the Catch Events section, select Timer.
Drop the timer event in the point where you want to add the delay.
If you want to delay the process until a specific date, configure the timer event as time date. If you want to delay the process for a certain period, 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.
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.
You can trigger a process using a time condition by adding a timer start event. 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 you deploy a process that contains a timer start event that specifies a date in the past, the BPMN Service Engine creates an instance in the process.
To design a process to start based on a time condition:
Edit the BPMN process.
If you want your process to have a single start event, right-click the start event and select Change Trigger Type and then Timer.
If you want your process to have multiple start events, 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.
If you want the process to start on a specific date, configure the timer start event as time date. If you want the process to start after a certain period, 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.
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.
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, direct the token to an activity that sends a message to the customer.
To configure a deadline for an activity:
Locate the activity in your process for which you want to configure a deadline.
From the Component Palette, from the Catch Events section, select timer.
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.
Place the cursor over an end event and click to drop the sequence flow there.
If you want the deadline to happen on a specific date, configure the boundary timer catch event as time date. If you want the deadline to happen after a certain period, 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.
In the Implementation tab in the timer properties dialog, select Interrupting Event.
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.
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 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 activity.
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 project for more than three months it automatically ends the process.
You might want to use an error end event in the event subprocess event, so that the process does not finish running successfully.
To configure a deadline for a BPMN process:
Edit the BPMN process.
From the Component Palette, from the Activities section, select Subprocess Event.
Drop the event subprocess in the process.
Configure the start event in the subprocess event to be a timer event:
Right-click the start event in the subprocess event.
Select Properties.
Select the Implementation tab.
From the Implementation Type list, select Timer.
Select Interrupting Event.
If you want the deadline to happen on a specific date, configure the timer event as time date. If you want the deadline to happen after a certain period, 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.
If the token stays in the process longer than specified by the interrupting timer event, then the timer fires. When the timer start event in the subprocess event fires the token leaves the process and moves to the subprocess event.
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 interesting 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.
To run additional activities while an activity is running:
Locate the activity to run in parallel to the additional activities.
Create an additional process flow by adding activities connected by sequence flows, outside the main process flow.
Add a timer event as a boundary to the activity.
A sequence flow for you to connect to an activity appears.
Connect the sequence flow to the additional process flow you created.
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 more than one time while the activity in the main process flow is running.
Add a sub-process event to your process.
Right-click the start event in the sub-process event.
Select Properties.
Select the Implementation tab.
If you want the additional activities to run on a specific date, configure the timer event as time date. If you want the additional activities to run periodically, 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.
Add the additional activities to the sub-process event.
When the timer start event in the subprocess event 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 sub-process event defines. The timer start event may fire multiple times while the main process flow is running.
You can configure times 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.
To configure a timer event to use a specific date and time:
Right-click the timer event.
Select Properties.
Select the Implementation tab.
Select Time Date.
Provide a Date.
The following options are available to provide a date:
Click the calendar button next to the Date field. Select a date and enter a time and close the calendar dialog.
Enter the date in the Date field. For example: Jan. 18, 2010 4:31:10 PM
Select Use Expression and provide an expression that returns a Date.
See Section 21.4, "Writing Expressions in Timer Events" in Chapter 17, "Adding Delays, Deadlines and Time Based Cycles to Your Process" for more information.
Click OK.
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.
To configure a timer event to use an interval:
Right-click the timer event.
Select Properties.
Select the Implementation tab.
Select Cycle.
Provide a time interval or select Use Expression and write an expression that returns an Interval.
See Section 21.4, "Writing Expressions in Timer Events" for more information
Click OK.
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 was for the specified interval before firing, but it fires only one time.