Skip to content

Commit 6dfc23a

Browse files
committed
called suborchestrators 'child workflow' for consistency
Signed-off-by: Albert Callarisa <[email protected]>
1 parent 9ed6b6d commit 6dfc23a

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

daprdocs/content/en/developing-applications/building-blocks/workflow/workflow-patterns.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,28 +1387,28 @@ External events don't have to be directly triggered by humans. They can also be
13871387
13881388
## Cross-app workflows
13891389
1390-
The cross-app workflow pattern enables workflows to call activities or start suborchestrators hosted in different Dapr applications.
1390+
The cross-app workflow pattern enables workflows to call activities or start child workflows hosted in different Dapr applications.
13911391
13921392
{{% alert title="Important Limitations" color="warning" %}}
13931393
- **Cross-namespace calls are not supported** - all applications must be in the **same namespace**
1394-
- **Only activity calls are supported in Java SDK** - Cross-app workflow activity calls are currently only available in the Java SDK. Suborchestrator calls are not supported yet. Other SDKs (Python, .NET, JavaScript, Go) do not support any cross-app features at this time.
1394+
- **Only activity calls are supported in Java SDK** - Cross-app workflow activity calls are currently only available in the Java SDK. Child workflow calls are not supported yet. Other SDKs (Python, .NET, JavaScript, Go) do not support any cross-app features at this time.
13951395
{{% /alert %}}
13961396
13971397
This is how cross-app call activity looks like:
13981398
13991399
<img src="/images/workflow-overview/workflow-crossapp-callactivity.png" width=800 alt="Diagram showing cross-app call activity workflow pattern">
14001400
1401-
This is how cross-app start suborchestrator looks like:
1401+
This is how cross-app start child workflow looks like:
14021402
1403-
<img src="/images/workflow-overview/workflow-crossapp-suborchestrator.png" width=800 alt="Diagram showing cross-app suborchestrator workflow pattern">
1403+
<img src="/images/workflow-overview/workflow-crossapp-suborchestrator.png" width=800 alt="Diagram showing cross-app child workflow pattern">
14041404
14051405
### Use cases and scenarios
14061406
14071407
Cross-app workflows are ideal for the following scenarios:
14081408
14091409
#### Shared activity pools
14101410
1411-
One of the main use cases is creating shared pools of workflow activities and suborchestrators that can be:
1411+
One of the main use cases is creating shared pools of workflow activities and child workflows that can be:
14121412
- Called from multiple workflow orchestrators running in different applications
14131413
- Scaled independently based on demand for different business functions
14141414
- Owned and maintained by different teams
@@ -1423,11 +1423,11 @@ Cross-app workflows enable different teams to own different parts of a larger bu
14231423
- **Team C** owns inventory activities
14241424
- **Team D** owns shipping activities
14251425
1426-
Each team can deploy, scale, and maintain their workflows and activities independently while participating in larger orchestrated workflows.
1426+
Each team can deploy, scale, and maintain their applications containing workflows and activities independently while participating in larger orchestrated workflows.
14271427
14281428
### Error handling
14291429
1430-
When calling cross-app suborchestrators or activities:
1430+
When calling cross-app activities or child workflows:
14311431
- If the target application does not exist, the call will be retried using the provided retry policy
14321432
- If the target application exists but doesn't contain the specified activity or workflow, the call will return an error
14331433
- Standard workflow retry policies apply to cross-app calls
@@ -1457,15 +1457,14 @@ public class MyWorkflow implements Workflow {
14571457
14581458
```
14591459
1460-
### Cross-app suborchestrator calls
1460+
### Cross-app child workflow calls
14611461
1462-
You can call suborchestrators hosted in different Dapr applications by providing the App ID when calling the suborchestrator.
1462+
You can call child workflows hosted in different Dapr applications by providing the App ID when calling the child workflow.
14631463
14641464
{{% alert title="Not Yet Supported" color="info" %}}
1465-
Cross-app suborchestrator calls are not supported yet in any SDK. This functionality is planned for future releases.
1465+
Cross-app child workflow calls are not supported yet in any SDK. This functionality is planned for future releases.
14661466
{{% /alert %}}
14671467
1468-
14691468
## Compensation
14701469
14711470
The compensation pattern (also known as the saga pattern) provides a mechanism for rolling back or undoing operations that have already been executed when a workflow fails partway through. This pattern is particularly important for long-running workflows that span multiple microservices where traditional database transactions are not feasible.
@@ -1509,58 +1508,58 @@ The following diagram illustrates this flow.
15091508
15101509
```java
15111510
public class PaymentProcessingWorkflow implements Workflow {
1512-
1511+
15131512
@Override
15141513
public WorkflowStub create() {
15151514
return ctx -> {
15161515
ctx.getLogger().info("Starting Workflow: " + ctx.getName());
15171516
var orderId = ctx.getInput(String.class);
15181517
List<String> compensations = new ArrayList<>();
1519-
1518+
15201519
try {
15211520
// Step 1: Reserve inventory
15221521
String reservationId = ctx.callActivity(ReserveInventoryActivity.class.getName(), orderId, String.class).await();
15231522
ctx.getLogger().info("Inventory reserved: {}", reservationId);
15241523
compensations.add("ReleaseInventory");
1525-
1524+
15261525
// Step 2: Process payment
15271526
String paymentId = ctx.callActivity(ProcessPaymentActivity.class.getName(), orderId, String.class).await();
15281527
ctx.getLogger().info("Payment processed: {}", paymentId);
15291528
compensations.add("RefundPayment");
1530-
1529+
15311530
// Step 3: Ship order
15321531
String shipmentId = ctx.callActivity(ShipOrderActivity.class.getName(), orderId, String.class).await();
15331532
ctx.getLogger().info("Order shipped: {}", shipmentId);
15341533
compensations.add("CancelShipment");
1535-
1534+
15361535
} catch (TaskFailedException e) {
15371536
ctx.getLogger().error("Activity failed: {}", e.getMessage());
1538-
1537+
15391538
// Execute compensations in reverse order
15401539
Collections.reverse(compensations);
15411540
for (String compensation : compensations) {
15421541
try {
15431542
switch (compensation) {
15441543
case "CancelShipment":
15451544
String shipmentCancelResult = ctx.callActivity(
1546-
CancelShipmentActivity.class.getName(),
1547-
orderId,
1545+
CancelShipmentActivity.class.getName(),
1546+
orderId,
15481547
String.class).await();
15491548
ctx.getLogger().info("Shipment cancellation completed: {}", shipmentCancelResult);
15501549
break;
1551-
1550+
15521551
case "RefundPayment":
15531552
String refundResult = ctx.callActivity(
1554-
RefundPaymentActivity.class.getName(),
1555-
orderId,
1553+
RefundPaymentActivity.class.getName(),
1554+
orderId,
15561555
String.class).await();
15571556
ctx.getLogger().info("Payment refund completed: {}", refundResult);
15581557
break;
1559-
1558+
15601559
case "ReleaseInventory":
15611560
String releaseResult = ctx.callActivity(
1562-
ReleaseInventoryActivity.class.getName(),
1563-
orderId,
1561+
ReleaseInventoryActivity.class.getName(),
1562+
orderId,
15641563
String.class).await();
15651564
ctx.getLogger().info("Inventory release completed: {}", releaseResult);
15661565
break;
@@ -1575,7 +1574,7 @@ public class PaymentProcessingWorkflow implements Workflow {
15751574
// Step 4: Send confirmation
15761575
ctx.callActivity(SendConfirmationActivity.class.getName(), orderId, Void.class).await();
15771576
ctx.getLogger().info("Confirmation sent for order: {}", orderId);
1578-
1577+
15791578
ctx.complete("Order processed successfully: " + orderId);
15801579
};
15811580
}

0 commit comments

Comments
 (0)