You are building a Durable Functions workflow that receives a list of 50,000 image URLs and must extract EXIF metadata for each image in parallel, then return a single aggregated list. The orchestrator must remain deterministic and be able to resume correctly after replays or restarts. What should you do in the orchestrator function to implement the fan-out/fan-in pattern?
Choose an answer
Tap an option to check your answer.
Correct answer: Iterate over the URLs, schedule each activity with CallActivityAsync`<T>`, collect the returned Task`<T>` objects in a list, then await Task.WhenAll(tasks) and aggregate the results..
Why this is the answer
The correct approach for fan-out/fan-in in Durable Functions is to iterate through the list of items (image URLs), schedule an activity function for each item using CallActivityAsync<T, collect the Task<T objects returned by these calls, and then use Task.WhenAll(tasks) to concurrently await the completion of all activities. Finally, aggregate the results. This ensures determinism, allows the orchestrator to resume correctly, and efficiently handles a large number of parallel operations. Using Parallel.ForEach directly in the orchestrator is incorrect because it is not deterministic and can lead to issues during replays. Invoking a single activity that loops through all URLs defeats the purpose of fan-out/fan-in and parallel processing, as it would execute sequentially within that single activity. Calling ContinueAsNew after each activity is not the correct pattern for fan-out/fan-in; ContinueAsNew is used for long-running orchestrations to reset state and prevent history growth, not for parallel execution.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed