ActiveVOS Designer User’s Guide

Adding an onAlarm Event Handler

The onAlarm element defines a timeout event, using either the duration (for) or deadline (until) attribute. The duration attribute specifies the amount of time after which the event will be signaled. The clock for the duration starts when the associated scope starts. The alternative deadline attribute sets the specific point in time when the alarm will be fired. Optionally a repeat every attribute can be set to fire an alarm repeatedly each time the interval period expires. The repeat every attribute can be used alone or with an deadline or duration attribute.

For example, you might set an alarm to go off in five minutes and then repeat the alarm every 30 seconds.

An alarm time can be set for the process using the data provided within the message that creates a process instance, as shown in the following example.

In the WSDL file, a complex message is defined with a part specifying processDuration.

<wsdl:definitions
  targetNamespace="http://www.example.com/wsdl/exmple"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  ...>
   <wsdl:message name="orderDetails">
    <part name="processDuration"
       type="xsd:duration"/>
   </wsdl:message>
</wsdl:definitions>

      

The message type above is used in the onAlarm value in the BPEL process:

<process name="orderCar"
  xmlns:def="http://www.example.com/wsdl/example" ...>
  ...
  <eventHandlers>
    <onAlarm 
      <for>$orderDetails.processDuration</for>
    </onAlarm>
  </eventHandlers>
  ...
  <variable name=”orderDetails” 
      messageType=”def:orderDetails”/>
  </variable>
  ...
  <receive name=”getOrder”
    partnerLink=”buyer”
    portType=”car”
    operation=”order”
    variable=”orderDetails”
    createInstance=”yes”/>
  ...
</process>

In the above example, the onAlarm element specifies a timer event that is fired when the duration specified in the processDuration field in the orderDetails variable is exceeded. The value of the field is provided via the getOrder activity that receives a message containing the order details and causes the creation of a process instance for that order.

Required and optional properties for an onAlarm handler

Required Properties

Optional Properties

Alarm Expression

Repeat Every (may be used with Alarm Type)

Alarm Type or Repeat Every

Documentation. See Adding Documentation to a Process

Comment. See Adding Comments to a Process

Setting Visual Properties and Using Your Own Library of Images

Execution State. See Viewing the Execution State of an Activity or Link

Extension Attributes and Elements. See Declaring Extension Elements and Attributes.

To add an onAlarm event handler for the process:

  1. Click on the Event Handlers tab of the Process Editor.
  2. Ensure that nothing is selected on the canvas, and right mouse click to select Add >Other>On Alarm.
  3. An onAlarm handler is added and is selected.

  4. In the Properties view, do the following:
    1. Optionally, in the Alarm Type field, select Deadline or Duration. An On Alarm can be only one type and can be used in conjunction with Repeat Every.
    2. In the Alarm Expression field, type in or compose an expression representing the duration or deadline for the alarm. See the example below in the illustration.
    3. Optionally, select the Dialog button at the end of the Repeat Every row. Type in or compose an expression for the interval. Use this attribute alone or in conjunction with a Deadline or Duration.
  5. From the Activity palette, drag an activity into the event handler to respond to the event, such as a reply or exit.
  6. Fill in the properties for the activity that handles the event.

The following illustration shows an example of an onAlarm event handler added for the process.

Example of  an onMessage and an onAlarm event handler added to the process

To add an onAlarm event handler for a scope:

  1. Display a BPEL file in the Process Editor, and select a scope.
  2. Right-mouse click and select Show Event Handlers.
  3. An event handler container is added to the scope.

  4. Right-mouse click in the Event Handler, and select Add>Other> On Alarm.
  5. In the Properties view, do the following:
    1. Optionally, in the Alarm Type field, select Deadline or Duration. An On Alarm can be only one type and can be used in conjunction with Repeat Every.
    2. In the Alarm Expression field, type in or compose an expression representing the duration or deadline for the alarm. See the example below in the illustration.
    3. Optionally, select the Dialog button at the end of the Repeat Every row. Type in or compose an expression for the interval. Use this attribute alone or in conjunction with a Deadline or Duration.
  6. From the Activity palette, drag an activity into the event handler to respond to the event, such as a reply or terminate.
  7. Fill in the properties for the activity that handles the event.

The following illustration shows an example of an onAlarm and an onEvent event handler added for a scope. The activity responding to each event is a reply.

Example of scope with an onMessage and an onAlarm event handler, with callouts

1

onEvent event handler

2

onAlarm event handler