Scheduler Processor
1. Scheduler
The PresentationServer Scheduler allows applications to start and stop periodic
tasks. A PresentationServer task is defined by a PresentationServer processor and
its inputs. You can start or stop a task at any time. The config input
must conform to the following schema:
<element name="config" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <interleave> <zeroOrMore> <element name="start-task"> <interleave> <element name="name"> </element> <choice> <element name="processor-name"> </element> <element name="processor-uri"> </element> </choice> <element name="start-time"> </element> <element name="interval"> </element> <optional> <element name="synchronized"> </element> </optional> <zeroOrMore> <element name="input"> <attribute name="name"/>
<choice> <attribute name="url"/>
<data type="string"/>
</choice> </element> </zeroOrMore> </interleave> </element> </zeroOrMore> <zeroOrMore> <element name="stop-task"> <element name="name"> </element> </element> </zeroOrMore> </interleave> </element>
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 a date in Java's
DateFormat
format.
|
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" xmlns:p="
http://www.orbeon.com/oxf/pipeline"
> <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" xmlns:p="
http://www.orbeon.com/oxf/pipeline"
> <p:input name="config"> </p:input> </p:processor>