0
votes

I'm throwing hundreds of activities and as I'm using a WhenAll I get the results after all activities have completed. But I was wondering if it is possible to get partial results when calling

durableClient.GetStatusAsync(instanceId).Output;

The code to wait for all activities:

await Task.WhenAll(activitiesTasks);
var resultsFromTasks = activitiesTasks.Select(x => x.Result);
return resultsFromTasks;
1

1 Answers

0
votes
  • Fan-in/Fan-out intrinsically is process of computing a bunch of tasks Parallele and aggregating the results of each of them. As you said await task.WhenAll(activitiesTasks); will aggregate the results of the activitiesTasks array whose task are working Parallele.

  • If you want to achieve partial result of the task before aggregation, then we can use the concept of sub-orchestrations. Here instead of tasks in the task array we call a separate orchestration function for a segment of task which will give us a partial answer.

  • This sub-orchestration is implemented using CallSubOrchestratorAsync then we will store this in a list. But at last, we will call task.WhenAll(); for aggregation. Here we will pass the list of the orchestration.

Refer the following documentation on Sub-orchestration.