Home > Back-end >  How do I pass an input variable from Data Factory to my durable function
How do I pass an input variable from Data Factory to my durable function

Time:06-29

I created an Azure Data Factory (ADF) function block that sends an HTTP trigger to my Azure Durable Function Start (or client function). Also, I created a parameter "amount" in ADF. Now I want to pass this parameter to my client function and then to the orchestrator function.

My client function looks like this:

import logging
import azure.functions as func
import azure.durable_functions as df
log = logging.getLogger(__name__)

async def main(req: func.HttpRequest, starter: str) -> func.HttpResponse:
    client = df.DurableOrchestrationClient(starter)

    args= {"amount":req.params.get("amount"))}

    instance_id = await client.start_new("DurableFunctionsOrchestrator", None, args)
    return client.create_check_status_response(req, instance_id)

You can see that I retrieved the variable amount in the code and want to send it to the orchestrator function using req.params.get("amount"). However, I dont' know how I can pass this parameter to the function using the Function block in Azure Data Factory. What expression should be added to the body?

CodePudding user response:

Instead of using the parameters of the HTTP-Trigger Function, you can use the header. So I recommend you to use the Header for your parameterization. enter image description here

In your query you can get the header values like this: enter image description here

  • Related