Complete the code to start a Durable Functions orchestration.
const client = df.getClient(context); const instanceId = await client.startNew('[1]', undefined, input);
The orchestration is started by calling startNew with the name of the orchestrator function.
Complete the code to call an activity function from an orchestrator.
const result = yield context.df.callActivity('[1]', input);
Inside an orchestrator, you call activity functions by their name using callActivity.
Fix the error in the orchestration code to wait for multiple activities to complete.
const tasks = [context.df.callActivity('A', inputA), context.df.callActivity('B', inputB)]; const results = yield [1](tasks);
To wait for all tasks to complete, use context.df.Task.whenAll.
Fill both blanks to create a durable timer that waits for 5 minutes.
const expiration = context.df.currentUtcDateTime.addMinutes([1]); yield context.df.createTimer([2]);
You add 5 minutes to the current time, then create a timer that waits until that expiration time.
Fill all three blanks to implement a fan-out/fan-in pattern that calls three activities and collects results.
const tasks = [context.df.callActivity([1], input1), context.df.callActivity([2], input2), context.df.callActivity([3], input3)]; const results = yield context.df.Task.whenAll(tasks);
Each activity function is called by its name as a string. The orchestrator function is not called here.