Long-term functions: returning results from Orchestrator

I have a use case that goes well with an example of a sequence of long-running functions: push the json payload through three functions, each of which modifies the json-graph and redirects it to the next function.

In the sequence example, the result of the sequence is retrieved by issuing a request to the orchestra.

In my use case, I want to directly return the result of three functions, essentially, as the answer of the third function.

Is there any way to do this? Is that even reasonable?

+4
source share
1 answer

, , . HTTP GetStatusAsync API . HTTP.

- , :

public static async Task<JObject> Run(JObject input, DurableOrchestrationClient client)
{
    string instanceId = await client.StartAsync("MyOrchestration", input);
    for (int i = 0; i < 60; i++)
    {
        var status = await client.GetStatusAsync(instanceId);
        if (status?.RuntimeStatus == "Completed")
        {
            return (JObject)status.Output;
        }

        // handle other status conditions, like failure

        await Task.Delay(TimeSpan.FromSeconds(1));
    }

    // handle timeouts
}

, , , . , , ? , , , ? , , , , .

+2

Source: https://habr.com/ru/post/1689512/


All Articles