Skip to content

Example Azure Functions project that implements different types of Bindings.

License

Notifications You must be signed in to change notification settings

rickvdbosch/functions-triggers-bindings-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

functions-triggers-bindings-example

Repo containing an example Azure Functions project that implements different types of input and output Bindings.

Accompanying blog posts:

Here are some blog posts giving more context and explaining the examples a bit more:

Examples

There are a few examples:

BlobTriggerInputBinding

This example shows you how to copy the triggering Blob into another container by coding it out completely. The steps implemented:

  • Connect to a Storage Account
  • Create a BlobClient
  • Get a reference to a container (and create it if it doesn't exist)
  • Get a reference to a blob
  • Upload the file

BlobTriggerInputBindingOutputBinding

This example shows you the power of an output binding: only one line of code to copy the blob!

BlobTriggerInputBindingOutputBinding2

In this Function, we add a message to a queue for each word in the triggering Blob. The only line of code we need for that is calling the Add() method on the ICollector<T>.

BlobTriggerInputBindingOutputBinding3

Dynamic output binding by using the Binder class.

HttpTriggerReturnBinding

The HttpTrigger isn't bound to a generic HttpRequest, but is TYPED to a RequestModel. The platform takes care of the deserialization of the message body for you.
The return binding above the Function does a couple of things for you:

  • It creates a Blob in the 'copied' container with a random GUID as the filename
  • It automatically writes the output of the Function call into that Blob

HttpTriggerPropertyBinding

The HttpTrigger isn't bound to a generic HttpRequest, but is TYPED to a RequestModel. The platform takes care of the deserialization of the message body for you.
The blob binding above the Function does a couple of things for you:

  • It creates a Blob in the 'properties' container with the value of the Identifier property as the filename
  • It writes the message of the posted model into that Blob

HttpTriggerTableInputBinding

In this Function example the Table Storage binding takes care of connecting to Table Storage. We’re automatically getting an instance of a CloudTable pointing to the right (partition of a) table, or even an instance of a typed entity, in the right storage account, all by simply specifying the binding the right way.

About

Example Azure Functions project that implements different types of Bindings.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages