mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Cleaned up the formatting, corrected some typos, updated the credentials guide to cover interactive login, and cleaned up the quick start.
50 lines
1.2 KiB
Markdown
50 lines
1.2 KiB
Markdown
<!--
|
|
title: Serverless Framework - Azure Functions Events - Timer
|
|
menuText: Timer
|
|
menuOrder: 2
|
|
description: Setting up Timer Events with Azure Functions via the Serverless Framework
|
|
layout: Doc
|
|
-->
|
|
|
|
<!-- DOCS-SITE-LINK:START automatically generated -->
|
|
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/azure/events/timer)
|
|
<!-- DOCS-SITE-LINK:END -->
|
|
|
|
# Timer Trigger
|
|
|
|
Azure Functions Timer trigger lets you listen on Azure Timer. Full documentation
|
|
can be found on
|
|
[azure.com](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer).
|
|
|
|
## Timer Events
|
|
|
|
### Timer Trigger
|
|
|
|
This setup specifies that the `hello` function should be run every 5 minutes
|
|
|
|
Here's an example:
|
|
|
|
```yml
|
|
# serverless.yml
|
|
|
|
functions:
|
|
example:
|
|
handler: handler.hello
|
|
events:
|
|
- timer:
|
|
x-azure-settings:
|
|
name: item #<string>, default - "myQueueItem", specifies which name it's available on `context.bindings`
|
|
schedule: 0 */5 * * * * #<string>, cron expression to run on
|
|
```
|
|
|
|
```javascript
|
|
// handler.js
|
|
|
|
'use strict';
|
|
|
|
module.exports.hello = function(context, timerObj) {
|
|
context.log("Timer ran");
|
|
context.done();
|
|
};
|
|
```
|