Scheduling Strategy
The first configuration option is the Scheduling Strategy. There are three possible options for scheduling components:
Timer driven: This is the default mode. The Processor will be scheduled to run on a regular interval. The interval at which the Processor is run is defined by the 'Run Schedule' option (see below).
Event driven: When this mode is selected, the Processor will be triggered to run by an event, and that event occurs when FlowFiles enter Connections feeding this Processor. This mode is currently considered experimental and is not supported by all Processors. When this mode is selected, the 'Run Schedule' option is not configurable, as the Processor is not triggered to run periodically but as the result of an event. Additionally, this is the only mode for which the 'Concurrent Tasks' option can be set to 0. In this case, the number of threads is limited only by the size of the Event-Driven Thread Pool that the administrator has configured.
CRON driven: When using the CRON driven scheduling mode, the Processor is scheduled to run periodically, similar to the Timer driven scheduling mode. However, the CRON driven mode provides significantly more flexibility at the expense of increasing the complexity of the configuration. The CRON driven scheduling value is a string of six required fields and one optional field, each separated by a space. These fields are:
Field | Valid values |
---|---|
Seconds |
0-59 |
Minutes |
0-59 |
Hours |
0-23 |
Day of Month |
1-31 |
Month |
1-12 or JAN-DEC |
Day of Week |
1-7 or SUN-SAT |
Year (optional) |
empty, 1970-2099 |
You typically specify values one of the following ways:
-
Number: Specify one or more valid value. You can enter more than one value using a comma-separated list.
-
Range: Specify a range using the <number>-<number> syntax.
-
Increment: Specify an increment using <start value>/<increment> syntax. For example, in the Minutes field, 0/15 indicates the minutes 0, 15, 30, and 45.
You should also be aware of several valid special characters:
-
* - Indicates that all values are valid for that field.
-
? - Indicates that no specific value is specified. This special character is valid in the Days of Month and Days of Week field.
-
L - You can append L to one of the Day of Week values, to specify the last occurrence of this day in the month. For example, 1L indicates the last Sunday of the month.
For example:
-
The string
0 0 13 * * ?
indicates that you want to schedule the processor to run at 1:00 PM every day. -
The string
0 20 14 ? * MON-FRI
indicates that you want to schedule the processor to run at 2:20 PM every Monday through Friday. -
The string
0 15 10 ? * 6L 2011-2017
indicates that you want to schedule the processor to run at 10:15 AM, on the last Friday of every month, between 2011 and 2017.
For additional information and examples, see the https://www.quartz-scheduler.org/documentation/quartz-2.2.2/tutorials/tutorial-lesson-06.html in the https://www.quartz-scheduler.org/documentation/.