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
This example demonstrate how you can create distributed workflows where the orchestrator doesn't host the workflow activities.
4
+
This example is composed by three Spring Boot applications:
5
+
-`orchestrator`: The `orchestrator` app contains the Dapr Workflow definition and expose REST endpoints to create and raise events against workflow instances.
6
+
-`worker-one`: The `worker-one` app contains the `RegisterCustomerActivity` definition, which will be orchstrated by the `orchestrator` app.
7
+
-`worker-two`: The `worker-two` app contains the `CustomerFollowupActivity` definition, which will be orchstrated by the `orchestrator` app.
8
+
9
+
To start the applications you need to run the following commands on separate terminals, starting from the `remote-activities` directory.
The workflow definition [`CustomerWorkflow`](orchstrator/src/main/java/io/dapr/springboot/examples/orchestrator/CustomerWorkflow.java) that you can find inside the `orchestrator` app,
41
+
performs the following orchestration when a new workflow instance is created:
42
+
43
+
- Call the `RegisterCustomerActivity` activity which can be found inside the `worker-one` application.
44
+
- You can find in the workflow definition the configuration to make reference to an Activity that is hosted by a different Dapr application.
- When the event is received, the workflow move forward to the last activity called `CustomerFollowUpActivity`, that can be found on the `worker-two` app.
- The workflow completes by handing out the final version of the `Customer` object that has been modified the workflow activities. You can retrieve the `Customer` payload
Copy file name to clipboardExpand all lines: spring-boot-examples/workflows/remote-activities/orchestrator/src/main/java/io/dapr/springboot/examples/orchestrator/CustomerWorkflow.java
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@
13
13
14
14
packageio.dapr.springboot.examples.orchestrator;
15
15
16
+
importio.dapr.durabletask.TaskCanceledException;
17
+
importio.dapr.durabletask.TaskFailedException;
16
18
importio.dapr.workflows.Workflow;
17
19
importio.dapr.workflows.WorkflowStub;
18
20
importio.dapr.workflows.WorkflowTaskOptions;
@@ -32,7 +34,7 @@ public WorkflowStub create() {
32
34
ctx.getLogger().info("Let's register the customer: {}", customer.getCustomerName());
Copy file name to clipboardExpand all lines: spring-boot-examples/workflows/remote-activities/orchestrator/src/main/java/io/dapr/springboot/examples/orchestrator/CustomersRestController.java
Copy file name to clipboardExpand all lines: spring-boot-examples/workflows/remote-activities/orchestrator/src/test/java/io/dapr/springboot/examples/orchestrator/DaprTestContainersConfig.java
0 commit comments