Document toolboxDocument toolbox

Scheduler

Description

This unit is a Source unit type.

The Scheduler unit is a more granular version of the Generator unit, allowing for more concise configurations of the period and frequency of event generation.

This unit generates events periodically using a cron expression, based on the event frequency, timezone, and content settings configured in the properties.

An event entering via the do port provides the start date for the event generation. The input event field used for the start date is configured in the unit properties. If no field is configured, system time is used by default.

If the start date is before the current moment, the unit will generate at once all events that would have been generated according to the expression, and then continue from now.

If the start date is after the current moment, the unit will start generating events from that moment.

If no dates are configured, the unit will start generating events when the Flow begins and stops when the Flow ends.

Events entering via the stop port signal the end of event generation. If no field is configured, the default value is null.

If the unit has already stopped, an event reaching the stop port will be discarded.

Events are output through the out port with the results of the cron expression.

If an error occurs, the events are enriched with standard error fields and set to the error output port.

Configuration

After dragging this unit into the Flow canvas, double-click it to access its configuration options. The following table describes the configuration options of this unit:

Tab

Field

Description

Tab

Field

Description

General

Name

Enter a name for the unit. It must start with a letter, and cannot contain spaces. Only letters, numbers, and underscores are allowed.

Cron expression

Enter the cron expression that defines when the events will be generated.

Click the Help tool icon to help you to generate the Cron expression:

Autostart

Indicate how to signal for the unit to start.

If switched on, the unit will start automatically when the Flow diagram starts.

If switched off, the unit requires an event from the do port to start. 

Time field name

Enter the name of an input event field containing the period start date to be added to the output event (optional).

Counter field name

Enter the name of an input event field containing an event order number, starting at zero, to be added to the output event (optional).

Time zone

Enter the time zone to be used to schedule the unit.

Start field

Enter the input event field to be used as the start date. If left blank, the default value is now.

End field

Enter the input event field to be used as the end date. If left blank, the default value is null.

Input ports

Port

Description

Port

Description

do

Input events determining the start date for event generation. The field used for the start date is configured in the unit properties. 

stop

Input events determining the end of event generation. The field used for the end date is configured in the unit properties. 

Output ports

Port

Description

Port

Description

out

this port outputs the indicated number of events at the given frequency, with optional fields containing the event order number and period start date.

error

This port outputs events that generated an error when evaluated against the expression. Standard error fields (error, exception) are added to the output events.

Example

Imagine you wish to generate events every second.

You can specify an expression in the Scheduler unit to fire events to a my.app table every second. To do it, we add a Tick unit to fire the request every time we need it. Then, connect it to the Scheduler unit through its in input port. Finally, we can send the events to Devo by connecting the Scheduler out output port to a Devo Sink unit.

In the Tick unit properties, set the fields to transform in the Fields tab.

In the Scheduler unit properties, specify the Cron expression, as well as the following fields:

You can click the Help icon to help you to generate the Cron expression:

In the Devo Sink unit properties, specify the my.app table.

After saving and starting the Flow, you must click the red button of the Tick unit to begin sending events.

Download this example

You can try this flow by downloading the following JSON file and uploading it to your domain using the Import option.