Orbeon Forms User Guide

Scheduler Processor

1. Scheduler

The Orbeon Forms Scheduler processor allows applications to start and stop periodic tasks. A task is defined by a processor and its inputs. You can start or stop a task at any time. The config input must conform to the following schema:

<grammar datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0"><start><ref name="config"/></start><define name="config"><element name="config"><interleave><zeroOrMore><element name="start-task"><interleave><element name="name"><data type="string"/></element><choice><element name="processor-name"><data type="QName"/></element></choice><element name="start-time"><data type="dateTime"/></element><element name="interval"><data type="long"/></element><optional><element name="synchronized"><data type="boolean"/></element></optional><zeroOrMore><element name="input"><attribute name="name"/><choice><attribute name="url"/><ref name="anyElement"/></choice></element></zeroOrMore></interleave></element></zeroOrMore><zeroOrMore><element name="stop-task"><element name="name"><data type="string"/></element></element></zeroOrMore></interleave></element></define><define name="anyElement"><element><anyName/><zeroOrMore><choice><attribute><anyName/></attribute><text/><ref name="anyElement"/></choice></zeroOrMore></element></define></grammar>

1.1. Starting a Task

You start a task by invoking the Scheduler processor with the start-task element. The following table describes the configuration elements.

name The name of the task
start-time Either now or an XML xs:dateTime value such as 2006-06-10T16:20:12 or 2006-06-10T16:20:12.514.
interval Interval between tasks in milliseconds. If set to 0, the task runs only once.
synchronized If set to true, the task won't run if the previous iteration is still running. Defaults to false.
processor-name The qualified name of the processor that is executed when the task runs.
input Inputs of the processor. The input can either be located in a separate file or inline.

In most cases, the task is described in an XPL pipeline. The following example shows how to use the PipelineProcessor to launch a periodic task.

<p:processor name="oxf:scheduler"><p:input name="config"><config><start-task><name>myTask</name><start-time>now</start-time><interval>10000</interval><processor-name>oxf:pipeline</processor-name><input name="config" url="oxf:/mytask.xpl"/></start-task></config></p:input></p:processor>

1.2. Stopping a Task

You can stop a task with the stop-task element and the name of the task.

<p:processor name="oxf:scheduler"><p:input name="config"><config><stop-task><name>myTask</name></stop-task></config></p:input></p:processor>