Time
1 hour
Difficulty
Beginner
CEU/CPE
1

Video Transcription

00:01
the last type of trigger that woolen about is the so called timer trigger
00:06
timer triggers allow you to run your function on a schedule. For example, you can it every five minutes or every hour or once a day at midnight.
00:17
Let's see how we can do that in natural portal.
00:24
Once again in our azure function, up will click on the plus button to create a new function,
00:30
and we'll select the time or tree girl in this case,
00:34
wounding our function timer trigger Cyber. The example
00:41
and old Eddie
00:43
the Wizard suggest that we're in actually every five minutes.
00:49
Let's do that. Let's say create
00:54
an actual will automatically create a function for us and it will set it up for a timer trigger, and it will also provide our default
01:03
implementation.
01:04
What will happen now is that every five minutes will see a log message that will look the information like timer trigger function executed at the time it is executed.
01:18
Let's add a little bit more called toe that so well, other check to check whether the timer trigger is delayed,
01:33
we'll save it. And of course, we can immediately test that thing.
01:38
So when we click on the run button.
01:41
There is no request body.
01:45
We'll see that the timer trigger is executed at 12. 16
01:49
6 42 AM
01:52
This is UTC time. Always.
01:56
We can wait the next five minutes and see whether this will This function will be executed.
02:04
So I waited for several minutes. And as you can see,
02:07
they're more executions of our function.
02:10
Let's see a little bit more in details. What is happening?
02:15
If we go through the locks, you will see that at 6:42 a.m.
02:20
We trigger the function manually
02:23
and it executed.
02:27
The next execution time was supposed to happen. It's 6 45 because we created the function at 6 40
02:36
Now, this is intermediate execution that we manually trigger.
02:40
If we don't trigger such type of executions,
02:45
the normal schedule will take into account. So as you can see 6 45 we had execution of the function. Then for the next four minutes, nothing happened in at 6 50 We executed it once again.
03:01
Now you can implement your functionality and you can test your timer on certain amounts easily. You can go and change the schedule just with the configuration file.
03:14
You can do this from the Porto. The configuration file that your support is to use is called function. Jason,
03:22
I can go and change the schedule toe one minute,
03:25
Save it.
03:28
And soon you will see that we will have executions much more often than every five minutes.
03:38
Now that I've waited a few more minutes, you can see that after our change in the function toe from the schedule or run the function every minute we see execution every minute. So we have execution at 6 52 a swell of 6 53 and so on.
03:57
I can go back and change the schedule to every five minutes. But because I don't wanna waste money on my azure account, one thing I can do is I can go and turn off the function so I will turn off the time trigger function.
04:14
That's where was the cute trigger function
04:17
because they will be executing every time when there is, ah, time for execution for the time three get or when there is a message for the Q trigger.
04:30
This is how you can create a
04:32
actual function that this trigger on specific schedule
04:38
so This is the last example for this model. Let's wrap up our model and learn about some security features for rational functions.

Up Next

Azure Functions

This Azure Functions course explains the core concepts of serverless services in Azure, how to develop functions that use different triggers and how to secure access of Azure Functions and manage configuration secrets.

Instructed By

Instructor Profile Image
Toddy Mladenov
Instructor