Code review

You can use dynamic timeouts in wait activities and in the timeout element of a receive choice activity. In both cases, you can specify either a period of time or an expiration date. These options will be explained in the next two chapters.

Time period

To specify a time period for a timeout in a receive choice activity or for a wait activity in Java code, complete the following steps:

  1. In the business process editor, click the Timeout element or the Wait activity.
  2. In the properties view, click the Details tab.
  3. For Expression language, select Java.
  4. Click Duration.
  5. For Expression Type, select Java.
  6. If the Question dialog appears, click Yes.
  7. In the text area, enter the Java code.
  8. On the toolbar, click the Save button .

The following image shows the timeout of this sample:

Note: the return value of the java snippet is interpreted as seconds.

Expiration date

To specify a dynamic expiration date for a timeout in a receive choice activity or for a wait activity with an XPath expression, complete the following steps:

  1. For your business process specify a variable of type dateTime.
  2. In the business process editor, click the Timeout element or the Wait activity.
  3. In the properties view, click the Details tab.
  4. For Expression language, select XPath 1.0.
  5. Click Date.
  6. For Expression Type, select Text.
  7. In the text area, enter the expression. If you want to set the value from the variable specified in step 1, you can use the following XPath extension:
    bpws:getVariableData('variable name')
  8. On the toolbar, click the Save button .

The following image shows the WaitUntilAppointment activity of this sample: