@Ron Pitts Since Durable Functions are code-based workflows, you have complete control over how the flow works as possible within code.
In this case, depending on which parts of the orchestration you need to run parallel, you will skip awaiting. Here is the approach I think you are looking for
- Call Activity 1 and
await
the call - Create two wait for external event calls for A and B
-
await
the one for A and when complete, call Activity B andawait
that call - Finally,
await
for event B
The code would look something like this
[FunctionName(nameof(SampleOrchestration))]
public async Task<List<string>> SampleOrchestration([OrchestrationTrigger] IDurableOrchestrationContext context)
{
var outputs = new List<string>();
// Wait for Call_Activity_1 to complete
var activity1Output = await context.CallActivityAsync<string>("Call_Activity_1", null);
// Wait for External Event A to complete
var externalEventA = context.WaitForExternalEvent<string>("ExternalEventA");
var externalEventB = context.WaitForExternalEvent<string>("ExternalEventB");
// Wait for External Event A
await externalEventA;
// Call Call_Activity_2
var activity2Output = await context.CallActivityAsync<string>("Call_Activity_2", null);
// Wait for External Event B
await externalEventB;
outputs.Add(activity1Output);
outputs.Add(activity2Output);
return outputs;
}