Orchestrator functions can also call other orchestrator functions (sub-orchestrators).
This enables re-use of orchestrators, and keeping them small and maintainable. Just like activity functions, sub-orchestrators can be chained, or executed in parallel.
This is an example where two sub-orchestrators are chained:
[FunctionName(nameof(CollectAndUpdateGameStatsOrchestrator))]
public async Task Run(
[OrchestrationTrigger] IDurableOrchestrationContext context,
ILogger logger)
{
var playerId = context.GetInput<string>();
var playerGameStats = await context.CallSubOrchestratorAsync<PlayerGameStats>(
nameof(CollectPlayerGameStatsOrchestrator),
playerId);
await context.CallSubOrchestratorAsync(
nameof(UpdatePlayerGameStatsOrchestrator),
playerGameStats);
}
Sub-orchestrations in Durable Functions
◀ Durable Functions | 🔼 Notify Support Challenge | 🔼 Fraud Detection Challenge | Eternal Orchestrations ▶