Example query for durable function http trigger

kanna 106 Reputation points
2022-02-19T14:50:40.107+00:00

How to send instance_id to a HTTPTrigger?
If I want send instance_id from a client, should I encode it in HTTPRequest?

async def main(req: func.HttpRequest, starter: str, instance_id: str)
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,000 questions
{count} votes

Accepted answer
  1. MughundhanRaveendran-MSFT 12,481 Reputation points
    2022-02-24T05:40:52.933+00:00

    @kanna ,

    Thanks for posting this Question in the Q&A forum.

    Instance id can be passed to other activity functions in the following way. Same as you mentioned in the question.

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

    Encoding is not required as Transfer-Encoding is already enabled by default in Functions and it is set to chucked (Transfer-Encoding: chunked). Following is the sample response from durable functions

    HTTP/1.1 202 Accepted
    Content-Type: application/json; charset=utf-8
    Date: Thu, 14 Dec 2021 06:13:51 GMT
    Location: http://localhost:7071/runtime/webhooks/durabletask/instances/d3b72dddefce4e758d92f4d411567177?taskHub={taskHub}&connection={connection}&code={systemKey}
    Retry-After: 10
    Transfer-Encoding: chunked

    {
    "id": "d3b72dddefce4e758d92f4d411567177",
    "sendEventPostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/d3b72dddefce4e758d92f4d411567177/raiseEvent/{eventName}?taskHub={taskHub}&connection={connection}&code={systemKey}",
    "statusQueryGetUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/d3b72dddefce4e758d92f4d411567177?taskHub={taskHub}&connection={connection}&code={systemKey}",
    "terminatePostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/d3b72dddefce4e758d92f4d411567177/terminate?reason={text}&taskHub={taskHub}&connection={connection}&code={systemKey}"
    }

    Reference : https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-instance-management?tabs=python#wait-for-orchestration-completion

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.