Robotronx
Robotronx

Reputation: 1818

Azure Functions - get parameter value in middleware

I am running a v4 Azure Function in an isolated process. It is triggered by a message coming from a Service Bus queue. I have created a simple middleware and would like to get my hands on the incoming data (a simple string). How can I do that from the middleware itself? It doesn't seem FunctionContext is of use in this case.

public class SimpleMiddleware : IFunctionsWorkerMiddleware
{
    public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next)
    {
        await next(context);
    }
}

Upvotes: 2

Views: 1289

Answers (1)

Brian Vallelunga
Brian Vallelunga

Reputation: 10201

The service bus message data and metadata is extracted and placed into the BindingData dictionary. Try looking at context.BindingContext.BindingData and find the key that exposes your message's data.

Upvotes: 3

Related Questions