You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*** Child workflow 6feadc5370184b4998e50875b20084f6 called
271
271
...
272
-
```
272
+
```
273
+
274
+
275
+
### Cross-app Workflow
276
+
277
+
This example demonstrates how to call child workflows and activities in different apps. The multiple Dapr CLI instances can be started using the following commands:
278
+
279
+
<!-- STEP
280
+
name: Run apps
281
+
expected_stdout_lines:
282
+
- '== APP == app1 - triggering app1 workflow'
283
+
- '== APP == app1 - received workflow call'
284
+
- '== APP == app1 - triggering app2 workflow'
285
+
- '== APP == app2 - received workflow call'
286
+
- '== APP == app2 - triggering app3 activity'
287
+
- '== APP == app3 - received activity call'
288
+
- '== APP == app3 - returning activity result'
289
+
- '== APP == app2 - received activity result'
290
+
- '== APP == app2 - returning workflow result'
291
+
- '== APP == app1 - received workflow result'
292
+
- '== APP == app1 - returning workflow result'
293
+
background: true
294
+
sleep: 20
295
+
-->
296
+
297
+
```sh
298
+
dapr run --app-id wfexample3 python3 cross-app3.py &
299
+
dapr run --app-id wfexample2 python3 cross-app2.py &
300
+
dapr run --app-id wfexample1 python3 cross-app1.py
301
+
```
302
+
<!-- END_STEP -->
303
+
304
+
When you run the apps, you will see output like this:
305
+
```
306
+
...
307
+
app1 - triggering app2 workflow
308
+
app2 - triggering app3 activity
309
+
...
310
+
```
311
+
among others. This shows that the workflow calls are working as expected.
312
+
313
+
314
+
#### Error handling on activity calls
315
+
316
+
This example demonstrates how the error handling works on activity calls across apps.
317
+
318
+
Error handling on activity calls across apps works as normal workflow activity calls.
319
+
320
+
In this example we run `app3` in failing mode, which makes the activity call return error constantly. The activity call from `app2` will fail after the retry policy is exhausted.
321
+
322
+
<!-- STEP
323
+
name: Run apps
324
+
expected_stdout_lines:
325
+
- '== APP == app1 - triggering app1 workflow'
326
+
- '== APP == app1 - received workflow call'
327
+
- '== APP == app1 - triggering app2 workflow'
328
+
- '== APP == app2 - received workflow call'
329
+
- '== APP == app2 - triggering app3 activity'
330
+
- '== APP == app3 - received activity call'
331
+
- '== APP == app3 - raising error in activity due to error mode being enabled'
332
+
- '== APP == app2 - received activity error from app3'
333
+
- '== APP == app2 - returning workflow result'
334
+
- '== APP == app1 - received workflow result'
335
+
- '== APP == app1 - returning workflow result'
336
+
sleep: 20
337
+
-->
338
+
339
+
```sh
340
+
export ERROR_ACTIVITY_MODE=true
341
+
dapr run --app-id wfexample3 python3 cross-app3.py &
342
+
dapr run --app-id wfexample2 python3 cross-app2.py &
343
+
dapr run --app-id wfexample1 python3 cross-app1.py
344
+
```
345
+
<!-- END_STEP -->
346
+
347
+
348
+
When you run the apps with the `ERROR_ACTIVITY_MODE` environment variable set, you will see output like this:
349
+
```
350
+
...
351
+
app3 - received activity call
352
+
app3 - raising error in activity due to error mode being enabled
353
+
app2 - received activity error from app3
354
+
...
355
+
```
356
+
among others. This shows that the activity calls are failing as expected, and they are being handled as expected too.
357
+
358
+
359
+
#### Error handling on workflow calls
360
+
361
+
This example demonstrates how the error handling works on workflow calls across apps.
362
+
363
+
Error handling on workflow calls across apps works as normal workflow calls.
364
+
365
+
In this example we run `app2` in failing mode, which makes the workflow call return error constantly. The workflow call from `app1` will fail after the retry policy is exhausted.
366
+
367
+
<!-- STEP
368
+
name: Run apps
369
+
expected_stdout_lines:
370
+
- '== APP == app1 - triggering app1 workflow'
371
+
- '== APP == app1 - received workflow call'
372
+
- '== APP == app1 - triggering app2 workflow'
373
+
- '== APP == app2 - received workflow call'
374
+
- '== APP == app2 - raising error in workflow due to error mode being enabled'
375
+
- '== APP == app1 - received workflow error from app2'
376
+
- '== APP == app1 - returning workflow result'
377
+
sleep: 20
378
+
-->
379
+
380
+
```sh
381
+
export ERROR_WORKFLOW_MODE=true
382
+
dapr run --app-id wfexample3 python3 cross-app3.py &
383
+
dapr run --app-id wfexample2 python3 cross-app2.py &
384
+
dapr run --app-id wfexample1 python3 cross-app1.py
385
+
```
386
+
<!-- END_STEP -->
387
+
388
+
When you run the apps with the `ERROR_WORKFLOW_MODE` environment variable set, you will see output like this:
389
+
```
390
+
...
391
+
app2 - received workflow call
392
+
app2 - raising error in workflow due to error mode being enabled
393
+
app1 - received workflow error from app2
394
+
...
395
+
```
396
+
among others. This shows that the workflow calls are failing as expected, and they are being handled as expected too.
0 commit comments