Skip to content

Commit ac073e2

Browse files
authored
rename cross app -> multi app (#1555)
Signed-off-by: Cassandra Coyle <[email protected]>
1 parent dffa92a commit ac073e2

File tree

15 files changed

+86
-86
lines changed

15 files changed

+86
-86
lines changed

examples/src/main/java/io/dapr/examples/workflows/README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Those examples contain the following workflow patterns:
5353
4. [External Event Pattern](#external-event-pattern)
5454
5. [Child-workflow Pattern](#child-workflow-pattern)
5555
6. [Compensation Pattern](#compensation-pattern)
56-
7. [Cross-App Pattern](#cross-app-pattern)
56+
7. [Multi-App Pattern](#multi-app-pattern)
5757

5858
### Chaining Pattern
5959
In the chaining pattern, a sequence of activities executes in a specific order.
@@ -682,49 +682,49 @@ Key Points:
682682
4. Each activity simulates work with a short delay for demonstration purposes
683683

684684

685-
### Cross-App Pattern
685+
### Multi-App Pattern
686686

687-
The cross-app pattern allows workflows to call activities that are hosted in different Dapr applications. This is useful for microservices architectures allowing multiple applications to host activities that can be orchestrated by Dapr Workflows.
687+
The multi-app pattern allows workflows to call activities that are hosted in different Dapr applications. This is useful for microservices architectures allowing multiple applications to host activities that can be orchestrated by Dapr Workflows.
688688

689-
The `CrossAppWorkflow` class defines the workflow. It demonstrates calling activities in different apps using the `appId` parameter in `WorkflowTaskOptions`. See the code snippet below:
689+
The `MultiAppWorkflow` class defines the workflow. It demonstrates calling activities in different apps using the `appId` parameter in `WorkflowTaskOptions`. See the code snippet below:
690690
```java
691-
public class CrossAppWorkflow implements Workflow {
691+
public class MultiAppWorkflow implements Workflow {
692692
@Override
693693
public WorkflowStub create() {
694694
return ctx -> {
695695
var logger = ctx.getLogger();
696696
logger.info("=== WORKFLOW STARTING ===");
697-
logger.info("Starting CrossAppWorkflow: {}", ctx.getName());
697+
logger.info("Starting MultiAppWorkflow: {}", ctx.getName());
698698
logger.info("Workflow name: {}", ctx.getName());
699699
logger.info("Workflow instance ID: {}", ctx.getInstanceId());
700700

701701
String input = ctx.getInput(String.class);
702-
logger.info("CrossAppWorkflow received input: {}", input);
702+
logger.info("MultiAppWorkflow received input: {}", input);
703703
logger.info("Workflow input: {}", input);
704704

705705
// Call an activity in another app by passing in an active appID to the WorkflowTaskOptions
706-
logger.info("Calling cross-app activity in 'app2'...");
707-
logger.info("About to call cross-app activity in app2...");
708-
String crossAppResult = ctx.callActivity(
706+
logger.info("Calling multi-app activity in 'app2'...");
707+
logger.info("About to call multi-app activity in app2...");
708+
String multiAppResult = ctx.callActivity(
709709
App2TransformActivity.class.getName(),
710710
input,
711711
new WorkflowTaskOptions("app2"),
712712
String.class
713713
).await();
714714

715715
// Call another activity in a different app
716-
logger.info("Calling cross-app activity in 'app3'...");
717-
logger.info("About to call cross-app activity in app3...");
716+
logger.info("Calling multi-app activity in 'app3'...");
717+
logger.info("About to call multi-app activity in app3...");
718718
String finalResult = ctx.callActivity(
719719
App3FinalizeActivity.class.getName(),
720-
crossAppResult,
720+
multiAppResult,
721721
new WorkflowTaskOptions("app3"),
722722
String.class
723723
).await();
724-
logger.info("Final cross-app activity result: {}", finalResult);
725-
logger.info("Final cross-app activity result: {}", finalResult);
724+
logger.info("Final multi-app activity result: {}", finalResult);
725+
logger.info("Final multi-app activity result: {}", finalResult);
726726

727-
logger.info("CrossAppWorkflow finished with: {}", finalResult);
727+
logger.info("MultiAppWorkflow finished with: {}", finalResult);
728728
logger.info("=== WORKFLOW COMPLETING WITH: {} ===" , finalResult);
729729
ctx.complete(finalResult);
730730
};
@@ -784,31 +784,31 @@ public class App3FinalizeActivity implements WorkflowActivity {
784784

785785
**Important Limitations:**
786786
- **Cross-app calls are currently supported for activities only**
787-
- **Child workflow cross-app calls (suborchestration) are NOT supported**
787+
- **Child workflow multi-app calls (suborchestration) are NOT supported**
788788
- The app ID must match the Dapr application ID of the target service
789789

790790
**Running the Cross-App Example:**
791791

792792
This example requires running multiple Dapr applications simultaneously. You'll need to run the following commands in separate terminals:
793793

794-
1. **Start the main workflow worker (crossapp-worker):**
794+
1. **Start the main workflow worker (multiapp-worker):**
795795
```sh
796-
dapr run --app-id crossapp-worker --resources-path ./components/workflows --dapr-grpc-port 50001 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.crossapp.CrossAppWorker
796+
dapr run --app-id multiapp-worker --resources-path ./components/workflows --dapr-grpc-port 50001 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.multiapp.MultiAppWorker
797797
```
798798

799799
2. **Start app2 worker (handles App2TransformActivity):**
800800
```sh
801-
dapr run --app-id app2 --resources-path ./components/workflows --dapr-grpc-port 50002 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.crossapp.App2Worker
801+
dapr run --app-id app2 --resources-path ./components/workflows --dapr-grpc-port 50002 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.multiapp.App2Worker
802802
```
803803

804804
3. **Start app3 worker (handles App3FinalizeActivity):**
805805
```sh
806-
dapr run --app-id app3 --resources-path ./components/workflows --dapr-grpc-port 50003 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.crossapp.App3Worker
806+
dapr run --app-id app3 --resources-path ./components/workflows --dapr-grpc-port 50003 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.multiapp.App3Worker
807807
```
808808

809809
4. **Run the workflow client:**
810810
```sh
811-
java -Djava.util.logging.ConsoleHandler.level=FINE -Dio.dapr.durabletask.level=FINE -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.crossapp.CrossAppWorkflowClient "Hello World"
811+
java -Djava.util.logging.ConsoleHandler.level=FINE -Dio.dapr.durabletask.level=FINE -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.multiapp.MultiAppWorkflowClient "Hello World"
812812
```
813813

814814
**Expected Output:**
@@ -819,15 +819,15 @@ The client will show:
819819
Input: Hello World
820820
Created DaprWorkflowClient successfully
821821
Attempting to start new workflow...
822-
Started a new cross-app workflow with instance ID: 001113f3-b9d9-438c-932a-a9a9b70b9460
822+
Started a new multi-app workflow with instance ID: 001113f3-b9d9-438c-932a-a9a9b70b9460
823823
Waiting for workflow completion...
824824
Workflow instance with ID: 001113f3-b9d9-438c-932a-a9a9b70b9460 completed with result: HELLO WORLD [TRANSFORMED BY APP2] [FINALIZED BY APP3]
825825
```
826826

827827
The workflow demonstrates:
828-
1. The workflow starts in the main worker (crossapp-worker)
829-
2. Calls an activity in 'app2' using cross-app functionality
830-
3. Calls an activity in 'app3' using cross-app functionality
828+
1. The workflow starts in the main worker (multiapp-worker)
829+
2. Calls an activity in 'app2' using multi-app functionality
830+
3. Calls an activity in 'app3' using multi-app functionality
831831
4. The workflow completes with the final result from all activities
832832

833833
This pattern is particularly useful for:

examples/src/main/java/io/dapr/examples/workflows/crossapp/App2TransformActivity.java renamed to examples/src/main/java/io/dapr/examples/workflows/multiapp/App2TransformActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
limitations under the License.
1212
*/
1313

14-
package io.dapr.examples.workflows.crossapp;
14+
package io.dapr.examples.workflows.multiapp;
1515

1616
import io.dapr.workflows.WorkflowActivity;
1717
import io.dapr.workflows.WorkflowActivityContext;

examples/src/main/java/io/dapr/examples/workflows/crossapp/App2Worker.java renamed to examples/src/main/java/io/dapr/examples/workflows/multiapp/App2Worker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
limitations under the License.
1212
*/
1313

14-
package io.dapr.examples.workflows.crossapp;
14+
package io.dapr.examples.workflows.multiapp;
1515

1616
import io.dapr.workflows.runtime.WorkflowRuntime;
1717
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;

examples/src/main/java/io/dapr/examples/workflows/crossapp/App3FinalizeActivity.java renamed to examples/src/main/java/io/dapr/examples/workflows/multiapp/App3FinalizeActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
limitations under the License.
1212
*/
1313

14-
package io.dapr.examples.workflows.crossapp;
14+
package io.dapr.examples.workflows.multiapp;
1515

1616
import io.dapr.workflows.WorkflowActivity;
1717
import io.dapr.workflows.WorkflowActivityContext;

examples/src/main/java/io/dapr/examples/workflows/crossapp/App3Worker.java renamed to examples/src/main/java/io/dapr/examples/workflows/multiapp/App3Worker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
limitations under the License.
1212
*/
1313

14-
package io.dapr.examples.workflows.crossapp;
14+
package io.dapr.examples.workflows.multiapp;
1515

1616
import io.dapr.workflows.runtime.WorkflowRuntime;
1717
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;

examples/src/main/java/io/dapr/examples/workflows/crossapp/CrossAppWorker.java renamed to examples/src/main/java/io/dapr/examples/workflows/multiapp/MultiAppWorker.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
limitations under the License.
1212
*/
1313

14-
package io.dapr.examples.workflows.crossapp;
14+
package io.dapr.examples.workflows.multiapp;
1515

1616
import io.dapr.workflows.runtime.WorkflowRuntime;
1717
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;
1818

19-
public class CrossAppWorker {
19+
public class MultiAppWorker {
2020

2121
public static void main(String[] args) throws Exception {
2222
// Register the Workflow with the builder
2323
WorkflowRuntimeBuilder builder = new WorkflowRuntimeBuilder()
24-
.registerWorkflow(CrossAppWorkflow.class);
24+
.registerWorkflow(MultiAppWorkflow.class);
2525

2626
// Build and start the workflow runtime
2727
try (WorkflowRuntime runtime = builder.build()) {
28-
System.out.println("CrossAppWorker started - registered CrossAppWorkflow only");
28+
System.out.println("MultiAppWorker started - registered MultiAppWorkflow only");
2929
runtime.start();
3030
}
3131
}

examples/src/main/java/io/dapr/examples/workflows/crossapp/CrossAppWorkflow.java renamed to examples/src/main/java/io/dapr/examples/workflows/multiapp/MultiAppWorkflow.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
limitations under the License.
1212
*/
1313

14-
package io.dapr.examples.workflows.crossapp;
14+
package io.dapr.examples.workflows.multiapp;
1515

1616
import io.dapr.workflows.Workflow;
1717
import io.dapr.workflows.WorkflowStub;
@@ -21,42 +21,42 @@
2121
* Example workflow that demonstrates cross-app activity calls.
2222
* This workflow calls activities in different apps using the appId parameter.
2323
*/
24-
public class CrossAppWorkflow implements Workflow {
24+
public class MultiAppWorkflow implements Workflow {
2525
@Override
2626
public WorkflowStub create() {
2727
return ctx -> {
2828
var logger = ctx.getLogger();
2929
logger.info("=== WORKFLOW STARTING ===");
30-
logger.info("Starting CrossAppWorkflow: {}", ctx.getName());
30+
logger.info("Starting MultiAppWorkflow: {}", ctx.getName());
3131
logger.info("Workflow name: {}", ctx.getName());
3232
logger.info("Workflow instance ID: {}", ctx.getInstanceId());
3333

3434
String input = ctx.getInput(String.class);
35-
logger.info("CrossAppWorkflow received input: {}", input);
35+
logger.info("MultiAppWorkflow received input: {}", input);
3636
logger.info("Workflow input: {}", input);
3737

3838
// Call an activity in another app by passing in an active appID to the WorkflowTaskOptions
39-
logger.info("Calling cross-app activity in 'app2'...");
40-
logger.info("About to call cross-app activity in app2...");
41-
String crossAppResult = ctx.callActivity(
39+
logger.info("Calling multi-app activity in 'app2'...");
40+
logger.info("About to call multi-app activity in app2...");
41+
String multiAppResult = ctx.callActivity(
4242
App2TransformActivity.class.getName(),
4343
input,
4444
new WorkflowTaskOptions("app2"),
4545
String.class
4646
).await();
4747

4848
// Call another activity in a different app
49-
logger.info("Calling cross-app activity in 'app3'...");
50-
logger.info("About to call cross-app activity in app3...");
49+
logger.info("Calling multi-app activity in 'app3'...");
50+
logger.info("About to call multi-app activity in app3...");
5151
String finalResult = ctx.callActivity(
5252
App3FinalizeActivity.class.getName(),
53-
crossAppResult,
53+
multiAppResult,
5454
new WorkflowTaskOptions("app3"),
5555
String.class
5656
).await();
57-
logger.info("Final cross-app activity result: {}", finalResult);
57+
logger.info("Final multi-app activity result: {}", finalResult);
5858

59-
logger.info("CrossAppWorkflow finished with: {}", finalResult);
59+
logger.info("MultiAppWorkflow finished with: {}", finalResult);
6060
logger.info("=== WORKFLOW COMPLETING WITH: {} ===", finalResult);
6161
ctx.complete(finalResult);
6262
};

examples/src/main/java/io/dapr/examples/workflows/crossapp/CrossAppWorkflowClient.java renamed to examples/src/main/java/io/dapr/examples/workflows/multiapp/MultiAppWorkflowClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
limitations under the License.
1212
*/
1313

14-
package io.dapr.examples.workflows.crossapp;
14+
package io.dapr.examples.workflows.multiapp;
1515

1616
import io.dapr.workflows.client.DaprWorkflowClient;
1717
import io.dapr.workflows.client.WorkflowInstanceStatus;
@@ -25,25 +25,25 @@
2525
* 2. Start a new workflow instance
2626
* 3. Wait for completion and get results
2727
*/
28-
public class CrossAppWorkflowClient {
28+
public class MultiAppWorkflowClient {
2929

3030
public static void main(String[] args) {
3131
if (args.length < 1) {
32-
System.out.println("Usage: CrossAppWorkflowClientExample <input>");
33-
System.out.println("Example: CrossAppWorkflowClientExample \"Hello World\"");
32+
System.out.println("Usage: MultiAppWorkflowClientExample <input>");
33+
System.out.println("Example: MultiAppWorkflowClientExample \"Hello World\"");
3434
return;
3535
}
3636

3737
String input = args[0];
38-
System.out.println("=== Starting Cross-App Workflow Client ===");
38+
System.out.println("=== Starting Multi-App Workflow Client ===");
3939
System.out.println("Input: " + input);
4040

4141
try (DaprWorkflowClient client = new DaprWorkflowClient()) {
4242
System.out.println("Created DaprWorkflowClient successfully");
4343

4444
// Start a new workflow instance
4545
System.out.println("Attempting to start new workflow...");
46-
String instanceId = client.scheduleNewWorkflow(CrossAppWorkflow.class, input);
46+
String instanceId = client.scheduleNewWorkflow(MultiAppWorkflow.class, input);
4747
System.out.printf("Started a new cross-app workflow with instance ID: %s%n", instanceId);
4848

4949
// Wait for the workflow to complete
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* limitations under the License.
1212
*/
1313

14-
package io.dapr.it.testcontainers.workflows.crossapp;
14+
package io.dapr.it.testcontainers.workflows.multiapp;
1515

1616
import io.dapr.workflows.WorkflowActivity;
1717
import io.dapr.workflows.WorkflowActivityContext;

sdk-tests/src/test/java/io/dapr/it/testcontainers/workflows/crossapp/App2Worker.java renamed to sdk-tests/src/test/java/io/dapr/it/testcontainers/workflows/multiapp/App2Worker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
* limitations under the License.
1212
*/
1313

14-
package io.dapr.it.testcontainers.workflows.crossapp;
14+
package io.dapr.it.testcontainers.workflows.multiapp;
1515

1616
import io.dapr.workflows.runtime.WorkflowRuntime;
1717
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;
1818

1919
/**
2020
* App2Worker - registers the App2TransformActivity.
21-
* This app will handle cross-app activity calls from the main workflow.
21+
* This app will handle multi-app activity calls from the main workflow.
2222
*/
2323
public class App2Worker {
2424

0 commit comments

Comments
 (0)