Azure Durable Functions-How to transform output into json

子昂 徐 1 Reputation point
2022-02-18T22:29:34.253+00:00

I am new to Azure Durable Functions and running it in Python 3. I have an HTTP client, an orchestrator, and an activity. I return client.create_check_status_response(req, instance_id) in the HTTP client, and I know I can get the output from the "statusQueryGetUri" link in it.

175996-image.png

But right now, I am only able to do so manually. So, I wonder, is there any way I can extract the 'output' from "statusQueryGetUri" automatically(maybe with another Azure Function?) and transform it into a JSON file?

175955-image.png

Any help and ideas are appreciated.

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

1 answer

Sort by: Most helpful
  1. Lohith GN 511 Reputation points
    2022-02-20T13:09:59.047+00:00

    Couple of concepts you need to understand.

    The purpose of Durable Functions is to encapsulate a long-running process. You have an orchestrator who orchestrates your process steps. Process steps are written as Activity Functions. Since the process steps can be long-running, the orchestrator keeps track of the steps but for the outside world will give a URI where you can query the status of the job. The consumers can keep checking the status query URI to see if the job is finished or not. Once finished you will get the data that you expect. This is the usual practice and the preferred approach.

    Another way is: Within your Durable function orchestrator - you need to have a while loop that keeps checking for the status of the activity function. If the activity is not finished - the loop will continue to check. If the status of the activity is done, then breaks the loop and returns the data back to the consumer. This is not a preferred approach as you don't know how much time the child activity takes. By doing this way - your consumer have no clue what is happening and will have to wait indefinitely before they get the response back. I wouldn't do it recommend this approach.


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.