Skip to content

Commit 83523e6

Browse files
authored
Merge pull request #37278 from olivoarroba/patch-4
Added a defined instance id to JS subOrchestration
2 parents ca458ab + 9f23724 commit 83523e6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

articles/azure-functions/durable/durable-functions-sub-orchestrations.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ In addition to calling activity functions, orchestrator functions can call other
1717

1818
An orchestrator function can call another orchestrator function by calling the [CallSubOrchestratorAsync](https://azure.github.io/azure-functions-durable-extension/api/Microsoft.Azure.WebJobs.DurableOrchestrationContext.html#Microsoft_Azure_WebJobs_DurableOrchestrationContext_CallSubOrchestratorAsync_) or the [CallSubOrchestratorWithRetryAsync](https://azure.github.io/azure-functions-durable-extension/api/Microsoft.Azure.WebJobs.DurableOrchestrationContext.html#Microsoft_Azure_WebJobs_DurableOrchestrationContext_CallSubOrchestratorWithRetryAsync_) methods in .NET, or the `callSubOrchestrator` or `callSubOrchestratorWithRetry` methods in JavaScript. The [Error Handling & Compensation](durable-functions-error-handling.md#automatic-retry-on-failure) article has more information on automatic retry.
1919

20-
Sub-orchestrator functions behave just like activity functions from the caller's perspective. They can return a value, throw an exception, and can be awaited by the parent orchestrator function.
20+
Sub-orchestrator functions behave just like activity functions from the caller's perspective. They can return a value, throw an exception, and can be awaited by the parent orchestrator function.
21+
22+
> [!NOTE]
23+
> Currently, it's necessary to provide an `instanceId` argument value to the subOrchestration API in JavaScript.
2124
2225
## Example
2326

@@ -102,9 +105,12 @@ module.exports = df.orchestrator(function*(context) {
102105

103106
// Run multiple device provisioning flows in parallel
104107
const provisioningTasks = [];
108+
var id = 0;
105109
for (const deviceId of deviceIds) {
106-
const provisionTask = context.df.callSubOrchestrator("DeviceProvisioningOrchestration", deviceId);
110+
const child_id = context.df.instanceId+`:${id}`;
111+
const provisionTask = context.df.callSubOrchestrator("DeviceProvisioningOrchestration", deviceId, child_id);
107112
provisioningTasks.push(provisionTask);
113+
id++;
108114
}
109115

110116
yield context.df.Task.all(provisioningTasks);

0 commit comments

Comments
 (0)