Skip to content

Commit 09cf40d

Browse files
committed
Fix examples
1 parent 3765d34 commit 09cf40d

File tree

1 file changed

+16
-48
lines changed

1 file changed

+16
-48
lines changed

articles/azure-functions/durable/durable-functions-bindings.md

Lines changed: 16 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,21 @@ module.exports = df.orchestrator(function*(context) {
141141
> The `durable-functions` library takes care of calling the synchronous `context.done` method when the generator function exits.
142142
::: zone-end
143143
::: zone pivot="programming-language-python"
144+
# [v2](#tab/python-v2)
144145

146+
```python
147+
import azure.functions as func
148+
import azure.durable_functions as df
149+
150+
myApp = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)
151+
152+
@myApp.orchestration_trigger(context_name="context")
153+
def my_orchestrator(context):
154+
result = yield context.call_activity("Hello", "Tokyo")
155+
return result
156+
```
157+
158+
# [v1](#tab/python-v1)
145159
```python
146160
import azure.durable_functions as df
147161

@@ -172,8 +186,9 @@ public String helloWorldOrchestration(
172186
```
173187
::: zone-end
174188

189+
::: zone pivot="programming-language-csharp,programming-language-java,programming-language-javascript"
175190
Most orchestrator functions call activity functions, so here is a "Hello World" example that demonstrates how to call an activity function:
176-
191+
::: zone-end
177192
::: zone pivot="programming-language-csharp"
178193
# [In-process](#tab/in-process)
179194

@@ -217,53 +232,6 @@ module.exports = df.orchestrator(function*(context) {
217232
return result;
218233
});
219234
```
220-
::: zone-end
221-
::: zone pivot="programming-language-python"
222-
223-
The example depends on whether you use the v1 or v2 Python programming model.
224-
225-
# [v2](#tab/python-v2)
226-
227-
```python
228-
import azure.functions as func
229-
import azure.durable_functions as df
230-
231-
myApp = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)
232-
233-
@myApp.orchestration_trigger(context_name="context")
234-
def my_orchestrator(context):
235-
result = yield context.call_activity("Hello", "Tokyo")
236-
return result
237-
```
238-
239-
# [v1](#tab/python-v1)
240-
241-
```python
242-
import azure.durable_functions as df
243-
244-
def orchestrator_function(context: df.DurableOrchestrationContext):
245-
input = context.get_input()
246-
result = yield context.call_activity('SayHello', input['name'])
247-
return result
248-
249-
main = df.Orchestrator.create(orchestrator_function)
250-
```
251-
252-
---
253-
254-
::: zone-end
255-
::: zone pivot="programming-language-powershell"
256-
257-
```powershell
258-
param($Context)
259-
260-
$name = $Context.Input.Name
261-
262-
$output = Invoke-DurableActivity -FunctionName 'SayHello' -Input $name
263-
264-
$output
265-
```
266-
267235
::: zone-end
268236
::: zone pivot="programming-language-java"
269237

0 commit comments

Comments
 (0)