Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Azure Function Triggers and Filters

Daron Yondem
December 19, 2017

Azure Function Triggers and Filters

This is part of a full day Serverless training I hosted for Microsoft Turkey in Istanbul talking about Azure Function Triggers and Function Filters.

Daron Yondem

December 19, 2017

More Decks by Daron Yondem

Other Decks in Programming


  1. Function Triggers
    and Filters
    Daron Yöndem

    View Slide

  2. 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.

    View Slide

  3. 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 ✔

    View Slide

  4. Creating our first “timer trigger” function!

    View Slide

  5. View Slide

  6. View Slide

  7. View Slide

  8. 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

    View Slide

  9. Creating our first input binding.

    View Slide

  10. View Slide

  11. View Slide

  12. Creating our first output binding.

    View Slide

  13. View Slide

  14. Creating an image resizer function

    View Slide

  15. View Slide

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

    View Slide

  17. 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.

    View Slide

  18. Creating errorhandling and validation filters.

    View Slide

  19. View Slide

  20. View Slide

  21. 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

    View Slide

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

    View Slide