The following config will attach a timer trigger and causes the function hello_world
to be called every 5 seconds. The configuration allows you to attach multiple timer triggers to the same function. You can use the cron
syntax. Take a look at the Timer documentation for more details.
functions:
hello_world:
handler: index.main_handler
runtime: Nodejs8.9
events:
- timer:
name: timer
parameters:
cronExpression: '*/5 * * * *'
enable: true
Note: timer triggers are enabled by default.
This will create and attach a timer for the function_two
function which is disabled. If enabled it will call the function_two
function every 1 minutes.
functions:
function_two:
handler: index.main_handler
runtime: Nodejs8.9
events:
- timer:
name: timer
parameters:
cronExpression: '0 */1 * * *'
enable: false
Name can be specified for a timer.
events:
- timer:
name: your-timer-name
When a timer trigger triggers a function, the following data structures are encapsulated in "event" and passed to the function. In addition, you can specify to pass the "message" for a timer trigger, which is null by default.
{
"Type": "timer",
"TriggerName": "EveryDay",
"Time": "2019-02-21T11:49:00Z",
"Message": "user define msg body"
}
Product