Durable Functions and child orchestration

Ron Pitts 20 Reputation points

I'm wondering how this is typically solved without using a child orchestration.

I currently have two activity triggers within a single orchestration trigger. Now one of those activity triggers should only fire once it receives an external event.

Additionally I want to introduce another external event


Start on Orchestration Trigger Secondary Action
Call_Activity 1
External Event A Call_Activity 2
External Event B

So basically the Orchestration Trigger will wait until Call_Activity_1, External Event A, External Event B have completed.

External Event A has a child activity called Call_Activity 2

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
3,049 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 15,136 Reputation points Microsoft Employee

    @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 and await that call
    • Finally, await for event B

    The code would look something like this

    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;
        return outputs;
    0 comments No comments