@@ -141,7 +141,21 @@ module.exports = df.orchestrator(function*(context) {
141
141
> The ` durable-functions ` library takes care of calling the synchronous ` context.done ` method when the generator function exits.
142
142
::: zone-end
143
143
::: zone pivot="programming-language-python"
144
+ # [ v2] ( #tab/python-v2 )
144
145
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 )
145
159
``` python
146
160
import azure.durable_functions as df
147
161
@@ -172,8 +186,9 @@ public String helloWorldOrchestration(
172
186
```
173
187
::: zone-end
174
188
189
+ ::: zone pivot="programming-language-csharp,programming-language-java,programming-language-javascript"
175
190
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
177
192
::: zone pivot="programming-language-csharp"
178
193
# [ In-process] ( #tab/in-process )
179
194
@@ -217,53 +232,6 @@ module.exports = df.orchestrator(function*(context) {
217
232
return result;
218
233
});
219
234
```
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
-
267
235
::: zone-end
268
236
::: zone pivot="programming-language-java"
269
237
0 commit comments