What happens when BindFunctionInputAsync method is called in middleware?

FJDSJK 0 Reputation points
2024-05-25T22:48:42.7733333+00:00

Hi,

I don't really have any issues, just wondering something. If I have a durable function (say an activity function), and I set up middleware, what would happen if I call BindFunctionInputAsync within the middleware?

Here https://github.com/Azure/azure-functions-dotnet-worker/blob/11ae12b306ee3512d8a7d1c28510ea840acc8066/src/DotNetWorker.Core/Context/Features/DefaultFunctionInputBindingFeature.cs it says that the function will return the cached value if BindFunctionInputAsync is called a second time during invocation. Does the process of invocation happen before the middleware executes, or after the middleware finishes executing but before the function executes? I saw the invocationId existing in my middleware when debugging, so I'm leaning towards the former.

I'm essentially trying to figure out if calling BindFunctionInputAsync in middleware before my function actually executes will result in doing twice the work (once in middleware and once when the function executes), or if my durable function will use whatever we get from BindFunctionInputAsync when it executes (i.e. it doesn't need to do the work twice).

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,513 questions
0 comments No comments
{count} votes