Azure Functions Triggers
Azure Functions come with a number of triggers, from HTTP, Timers, service bus, blob and many more. In this post we go over the different types of triggers available out of the box for Azure Functions.
Last week I covered the creating of functions and getting up and running, Azure Functions Getting Started
Azure Function Triggers
Azure functions have a number of quick start templates for different triggers in C#, F# and Javascript. These are out of the box and have some default code.
- HTTP Trigger
When a HTTP request is made to the function, the functions code will be executed. It provides a REST API endpoint that can be called with a HTTP post request.
- Timer Trigger
This is a trigger that is based on a schedule. You can define the schedule and it will execute the code in the function.
To create a schedule you use the CRON Expression
A timer trigger is made up of
{second} {minute} {hour} {day} {month} {day-of-week}
Examples
Once every 5 minutes
0 */5 * * * *
Trigger once every two hours
0 0 */2 * * *
Trigger once every hour from 9 AM to 5 PM
0 0 9-17 * * *
Trigger At 9:30 AM every weekday
0 30 9 * * 1-5
- Queue Trigger
This is a trigger that will execute the code whenever a message is added to a selected Azure Queue Storage
- Blob Trigger
When an item is added to a specified Blob Storage container the code will be executed.
- EventHub Trigger
When an event is added to the selected event hub the code in the function will execute.
- Servicebus Queue Trigger
When a message is added to a selected Service Bus queue, this function will be executed.
- Servicebus Topic Trigger
When a message is added to a specified Service Bus topic, then this function will be triggered.
With these triggers we have alot of flexibility to create a very flexible application.