Skip to content

Commit b055185

Browse files
committed
Add Python, JavaScript, and PowerShell samples for overriding orchestration version
1 parent b711219 commit b055185

1 file changed

Lines changed: 48 additions & 6 deletions

File tree

articles/azure-functions/durable/durable-functions-orchestration-versioning.md

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -633,16 +633,35 @@ public static async Task<HttpResponseData> HttpStart(
633633
```
634634

635635
# [JavaScript](#tab/javascript)
636+
```javascript
637+
const HttpStart: HttpHandler = async (request: HttpRequest, context: InvocationContext): Promise<HttpResponse> => {
638+
const client = df.getClient(context);
639+
const instanceId = await client.startNew("ProcessOrderOrchestrator", {
640+
input: orderId,
641+
version: "1.0"
642+
});
636643

637-
Starting an orchestration with a specific version different from the current `defaultVersion` specified in your `host.json` is currently not supported in JavaScript.
644+
// ...
645+
};
646+
```
638647

639648
# [Python](#tab/python)
649+
```python
650+
async def http_start(req: func.HttpRequest, client):
651+
client = df.DurableOrchestrationClient(starter)
652+
instance_id = await client.start_new("ProcessOrderOrchestrator", client_input=order_id, version="1.0")
640653

641-
Starting an orchestration with a specific version different from the current `defaultVersion` specified in your `host.json` is currently not supported in Python.
654+
# ...
655+
```
642656

643657
# [PowerShell](#tab/powershell)
658+
```powershell
659+
param($Request, $TriggerMetadata)
644660
645-
Starting an orchestration with a specific version different from the current `defaultVersion` specified in your `host.json` is currently not supported in PowerShell.
661+
$instanceId = Start-DurableOrchestration -FunctionName "ProcessOrderOrchestrator" -Input $orderId -Version "1.0"
662+
663+
# ...
664+
```
646665

647666
# [Java](#tab/java)
648667

@@ -688,16 +707,39 @@ public static async Task<string> RunMainOrchestrator(
688707
```
689708

690709
# [JavaScript](#tab/javascript)
710+
```javascript
711+
const RunMainOrchestrator: OrchestrationHandler = function* (context: OrchestrationContext) {
712+
const paymentResult = yield context.df.callSubOrchestrator(
713+
"ProcessPaymentOrchestrator",
714+
orderId,
715+
{ version: "1.0" }
716+
);
691717

692-
Starting a sub-orchestration with a specific version different from the current `defaultVersion` specified in your `host.json` is currently not supported in JavaScript.
718+
// ...
719+
};
720+
```
693721

694722
# [Python](#tab/python)
723+
```python
724+
@myApp.orchestration_trigger(context_name="context")
725+
def run_main_orchestrator(context: df.DurableOrchestrationContext):
726+
payment_result = yield context.call_sub_orchestrator(
727+
"ProcessPaymentOrchestrator",
728+
order_id,
729+
version="1.0"
730+
)
695731

696-
Starting a sub-orchestration with a specific version different from the current `defaultVersion` specified in your `host.json` is currently not supported in Python.
732+
# ...
733+
```
697734

698735
# [PowerShell](#tab/powershell)
736+
```powershell
737+
param($Context)
738+
739+
$paymentResult = Invoke-SubOrchestrator -FunctionName "ProcessPaymentOrchestrator" -Input $orderId -Version "1.0"
699740
700-
Starting a sub-orchestration with a specific version different from the current `defaultVersion` specified in your `host.json` is currently not supported in PowerShell.
741+
# ...
742+
```
701743

702744
# [Java](#tab/java)
703745

0 commit comments

Comments
 (0)