phil
phil

Reputation: 2187

How do Azure Functions Bindings Work?

I am fascinated by the way in which Azure Functions allow so many method signatures via bindings. Does any know how they work under the covers or have any links to resources which describe it?

I get that the bindings have to be specified but how does the framework figure out the method signature to invoke?

Upvotes: 1

Views: 490

Answers (2)

mathewc
mathewc

Reputation: 13558

A great way to learn how bindings work is to write one yourself! We have a wiki page Binding Extensions Overview on how to get started, along with links to sample bindings and starter projects. The general binding pipeline is described in The Binding Process. Even if you don't go off and write your own extension, those links will help you understand things. You could also debug through the sample bindings or actual bindings to see how they work - it's all open source :) Many of the bindings you'll recognize from Azure Functions live in this azure-webjobs-sdk-extensions repo, so you can see their inner workings there. Other core bindings live in azure-webjobs-sdk.

All Azure Functions bindings are behind the scenes WebJobs SDK binding extensions as described in those wiki links. Azure Functions layers on top of this foundation and brings a cross language JSON based metadata model to it, as described in the Azure Functions: The Journey blog post.

Upvotes: 5

Andy T
Andy T

Reputation: 9881

I don't think there are any public documents describing in detail how it works, however, the project is open-source, so you can view the code yourself: https://github.com/Azure/azure-webjobs-sdk-script/

There is quite a bit of code involved, but I would focus in: https://github.com/Azure/azure-webjobs-sdk-script/tree/dev/src/WebJobs.Script/Description

Here is the code that gets the function parameters: https://github.com/Azure/azure-webjobs-sdk-script/blob/dev/src/WebJobs.Script/Description/DotNet/DotNetFunctionDescriptorProvider.cs#L72

Upvotes: 2

Related Questions