Soracom Flux
Scheduled Timer Event Source
When you select Scheduled Timer as the event source for the Flux App, The app will be triggered based on the schedule you set, such as a specific time or day of the week.
The Scheduled Timer Event Source is available on the Standard plan.
- Please refer to Soracom Flux Plans for more information about the Standard plan.
Event Source Configuration
Set the conditions for when event messages should be published to the channel from the event source.
- Enabled: To send messages using the scheduled timer, set to
Enable
. If set toDisable
, no message will be sent. - Cron Expression: Specify when to start the Flux app with a Cron expression; see About Cron Expressions for more information.
- Timezone: Select the time zone for the given Cron expression.
- Event Payload: Sets the JSON object that is sent to the attached channel when the Scheduled Timer starts.
- Description: Enter a description of the Scheduled Timer.
Cron Expression
A Cron expression is a way to set up a schedule to automatically execute a program or process at a specific time or day of the week. For example, you can set up a schedule that says, “I want the Flux app to start every day at 9:00 AM” or “I want it to start every Monday at 12:00 PM. In the Scheduled Timer event source, you can use this Cron expression to launch the Flux app at a specified time.
A Cron expression is a sequence of five items: “minute,” “hour,” “day,” “month,” and “day of the week.
Min Hour Day Month Weekday
Each field has the following meaning:
Field | Range | Description |
---|---|---|
Min | 0-59 | The minute at which the task runs |
Hour | 0-23 | The hour at which the task runs (24-hour format) |
Day | 1-31 | The day of the month the task runs |
Month | 1-12 (or JAN to DEC) | The month in which the task runs |
Weekday | 0-6 (or SUN to SAT) | The day of the week the task runs (0 = Sunday, 1 = Monday, …) |
Each field allows flexible scheduling using special symbols (*
, ,
, /
, etc.). The meanings of these special characters are as follows:
Special Character | Usable Fields | Description |
---|---|---|
, |
Min Hour Day Month Weekday | A comma is used to specify multiple values. For example, in the [Weekday] field, MON,WED,FRI represents [Monday, Wednesday, and Friday]. |
* |
Min Hour Day Month Weekday | An asterisk (wildcard) represents all possible values. For example, in the [Min] field, * means [every minute]. |
- |
Min Hour Day Month Weekday | A hyphen is used to specify a range. For example, in the [Hour] field, 9-17 represents [from 9 AM to 5 PM]. |
/ |
Min Hour Day Month Weekday | A slash is used to specify increments. For example, in the [Min] field, 30/10 means [starting at minute 30, then every 10 minutes], i.e., 30 min, 40 min, 50 min, etc. |
? |
Day Weekday | A question mark is used in the [Day] or [Weekday] fields. - If a value is specified in one of these fields, the other cannot be used. - Use ? in the other field. |
L |
Day Weekday | L stands for [last] and is used in the [Day] or [Weekday] fields. In the [Day] field, L means [the last day of the month]. In the [Weekday] field, 5L represents [the last Friday of the month]. Note that L can only be used once in a field and cannot be used together with other special characters. |
# |
Weekday | # is used to specify [the nth occurrence of a weekday in a month]. In the [Weekday] field, MON#2 means [the 2nd Monday of the month]. Note that # can only be used once in a field and cannot be used together with other special characters. |
Input Examples
Every day at 9:00 AM
0 9 * * ?
Every Friday at 5:00 PM
0 17 ? * FRI
Every weekday from 9:00 AM to 5:00 PM, every 15 minutes
*/15 9-17 ? * MON-FRI
The last Friday of every month at 12:00 AM
0 0 ? * 5L
The execution time of scheduled timer event sources may be delayed by up to 5 minutes.
- Flux apps may not start at the specified time for load balancing or other purposes. The time may be delayed by up to 5 minutes.
Daylight-Savings Time in Scheduled Timer Event Source
- If the time zone specified in the schedule timer event source has daylight saving time, the schedule will automatically adjust to daylight saving time. When time advances into spring, if the Cron expression corresponds to a non-existent date/time, the schedule call will be skipped. When time moves back to fall, the schedule is executed only once, and that call is not repeated. The next call will typically take place at the specified date and time.
- The Daylight Saving Time adjustment does not apply to schedules in Coordinated Universal Time (UTC).
Data Format
The data sent to a channel configured with the Scheduled Timer event source consists of Message and Context.
You can check the data received by the event to the Flux App in the History tab of Soracom Flux Studio. For more details, refer to View Logs.
Message
Message specified in the Event Payload, or null
if not specified.
Context
Data related to the Scheduled Timer. Here's an example:
{
"eventType": "schedule",
"time": "<time>",
"scheduledTime": "<scheduledTime>",
"scheduleId": "<scheduleId>",
"timestamp": <unixtime>
}
The attributes are as follows:
Attribute | Description |
---|---|
eventType |
The type of event. When the Scheduled Timer triggers the Flux App, the value is schedule . |
time |
The time the schedule timer actually started (ISO 8601 format). |
scheduledTime |
The time the schedule timer actually started (ISO 8601 format). |
scheduleId |
An ID assigned to each Scheduled Timer. |
timestamp |
The date and time when the Flux App execution was triggered by the Scheduled Timer event source (UNIX time in milliseconds). |
To reference the above Context in an action, input it as ${event.context.<CONTEXT_ATTRIBUTE>}
or event.context.<CONTEXT_ATTRIBUTE> == 1
.