Slide 1

Slide 1 text

Function Triggers and Filters Daron Yöndem http://daron.me @daronyondem

Slide 2

Slide 2 text

Function Triggers and Bindings • A trigger defines how a function is invoked. • Triggers have associated data, which is usually the payload that triggered the function. • Input and output bindings provide a declarative way to connect to data from within your code.

Slide 3

Slide 3 text

High level look of what’s available More; https://goo.gl/TEyuND Type Service Trigger Input Output Timer Azure Functions ✔ HTTP Azure Functions ✔ ✔ Blob Azure Storage ✔ ✔ ✔ Events Azure Event Hubs ✔ ✔ Queues Azure Storage ✔ ✔ Tables Azure Storage ✔ ✔ No-SQL Azure Cosmos DB ✔ ✔ ✔ Push Notifications Azure Notification Hubs ✔

Slide 4

Slide 4 text

Creating our first “timer trigger” function! DEMO

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

What you can do with timer triggers? • Run at explicitly specified intervals, like every day at 2:00 am using CRON expressions, like “0 */5 * * * *“ (every 5 minutes) • Can send information to other systems, but typically don’t “return” information, only write to logs • Great for redundant cleanup and data management • Great for checking state of services • Can be combined with other functions

Slide 9

Slide 9 text

Creating our first input binding. DEMO

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Creating our first output binding. DEMO

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Creating an image resizer function DEMO

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

What are Function Filters? • Encapsulate common logic to be shared across many different functions • Validation, logging, error handling • Similar to ASP.NET Filters https://goo.gl/qzT1bE

Slide 17

Slide 17 text

Filter Types • Invocation Filters - have both Executing/Executed methods that are called immediately before and immediately after the target job function is invoked. • Exception Filters - Exception filters will be called for exceptions occurring at any stage in the execution pipeline.

Slide 18

Slide 18 text

Creating errorhandling and validation filters. DEMO

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Links worth sharing Imperative bindings are available for C# • https://goo.gl/6UDoh7 Using .NET class libraries with Azure Functions • https://goo.gl/HExTPZ More on Function Filters • https://goo.gl/51ET18

Slide 22

Slide 22 text

Thanks http://daron.me | @daronyondem Download slides here; http://daron.me/decks