Skip to content

Commit 3288005

Browse files
committed
fix Cassie's suggestions
1 parent 8ba6b83 commit 3288005

File tree

7 files changed

+14
-27
lines changed

7 files changed

+14
-27
lines changed

spring-boot-examples/workflows/multi-app/README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Multi App workflow Example
22

3-
This example demonstrate how you can create distributed workflows where the orchestrator doesn't host the workflow activities.
3+
This example demonstrates how you can create distributed workflows where the orchestrator doesn't host the workflow activities.
44

55
For more documentation about how Multi App Workflows work [check the official documentation here](https://v1-16.docs.dapr.io/developing-applications/building-blocks/workflow/workflow-multi-app/).
66

77
This example is composed by three Spring Boot applications:
88
- `orchestrator`: The `orchestrator` app contains the Dapr Workflow definition and expose REST endpoints to create and raise events against workflow instances.
9-
- `worker-one`: The `worker-one` app contains the `RegisterCustomerActivity` definition, which will be orchstrated by the `orchestrator` app.
10-
- `worker-two`: The `worker-two` app contains the `CustomerFollowupActivity` definition, which will be orchstrated by the `orchestrator` app.
9+
- `worker-one`: The `worker-one` app contains the `RegisterCustomerActivity` definition, which will be called by the `orchestrator` app.
10+
- `worker-two`: The `worker-two` app contains the `CustomerFollowupActivity` definition, which will be called by the `orchestrator` app.
1111

12-
To start the applications you need to run the following commands on separate terminals, starting from the `remote-activities` directory.
12+
To start the applications you need to run the following commands on separate terminals, starting from the `multi-app` directory.
1313
To start the `orchestrator` app run:
1414
```bash
1515
cd orchestrator/
@@ -89,11 +89,3 @@ This test interact with the application REST endpoints to validate their correct
8989
But the magic behind the test can be located in the [`DaprTestContainersConfig.class`](orchestrator/src/test/java/io/dapr/springboot/examples/orchestrator/DaprTestContainersConfig.java) which defines the configuration for
9090
all the Dapr containers and the `worker-one` and `worker-two` applications. Check this class to gain a deeper understand how to configure
9191
multiple Dapr-enabled applications.
92-
93-
94-
95-
96-
97-
98-
99-

spring-boot-examples/workflows/multi-app/orchestrator/src/main/java/io/dapr/springboot/examples/orchestrator/CustomersRestController.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,5 @@ public Customer getCustomerOutput(@RequestBody Customer customer) {
106106
return instanceState.readOutputAs(Customer.class);
107107
}
108108

109-
110-
111109
}
112110

spring-boot-examples/workflows/multi-app/orchestrator/src/test/java/io/dapr/springboot/examples/orchestrator/DaprTestContainersConfig.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,21 @@ public DaprContainer workerOneDapr(Network daprNetwork, RedisContainer redisCont
116116
.dependsOn(daprSchedulerContainer)
117117
.dependsOn(redisContainer);
118118
}
119+
119120
@Bean
120121
@ConditionalOnProperty(prefix = "tests", name = "workers.enabled", havingValue = "true")
121122
public GenericContainer<?> workerOneContainer(Network daprNetwork,
122123
@Qualifier("workerOneDapr") DaprContainer workerOneDapr,
123124
DaprPlacementContainer daprPlacementContainer,
124125
DaprSchedulerContainer daprSchedulerContainer){
125126
return new GenericContainer<>("openjdk:17-jdk-slim")
126-
.withCopyFileToContainer(MountableFile.forHostPath("../worker-one/target"), "/app")
127+
.withCopyFileToContainer(MountableFile.forHostPath("../worker-one/target/*.jar"), "/app/worker-one.jar")
127128
.withWorkingDirectory("/app")
128129
.withCommand("java",
129130
"-Ddapr.grpc.endpoint=worker-one:50001",
130131
"-Ddapr.http.endpoint=worker-one:3500",
131132
"-jar",
132-
"worker-one-1.17.0-SNAPSHOT.jar")
133+
"worker-one.jar")
133134
.withNetwork(daprNetwork)
134135
.dependsOn(workerOneDapr)
135136
.dependsOn(daprPlacementContainer)
@@ -171,7 +172,7 @@ public GenericContainer<?> workerTwoContainer(Network daprNetwork,
171172
"-Ddapr.grpc.endpoint=worker-two:50001",
172173
"-Ddapr.http.endpoint=worker-two:3500",
173174
"-jar",
174-
"worker-two-1.17.0-SNAPSHOT.jar")
175+
"worker-two.jar")
175176
.withNetwork(daprNetwork)
176177
.dependsOn(workerTwoDapr)
177178
.dependsOn(daprPlacementContainer)
@@ -180,7 +181,6 @@ public GenericContainer<?> workerTwoContainer(Network daprNetwork,
180181
.withLogConsumer(outputFrame -> System.out.println("WorkerTwoApplication: " + outputFrame.getUtf8String()));
181182
}
182183

183-
184184
@Bean
185185
public RedisContainer redisContainer(Network daprNetwork, Environment env){
186186
boolean reuse = env.getProperty("reuse", Boolean.class, false);
@@ -211,6 +211,4 @@ public DaprContainer daprContainer(Network daprNetwork, RedisContainer redisCont
211211
.dependsOn(redisContainer);
212212
}
213213

214-
215-
216214
}

spring-boot-examples/workflows/multi-app/worker-one/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
<plugin>
5454
<groupId>org.springframework.boot</groupId>
5555
<artifactId>spring-boot-maven-plugin</artifactId>
56+
<configuration>
57+
<finalName>worker-one</finalName>
58+
</configuration>
5659
<executions>
5760
<execution>
5861
<goals>

spring-boot-examples/workflows/multi-app/worker-one/src/test/java/io/dapr/springboot/examples/workerone/DaprTestContainersConfig.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
@TestConfiguration(proxyBeanMethods = false)
3636
public class DaprTestContainersConfig {
3737

38-
3938
@Bean
4039
public Network getDaprNetwork(Environment env) {
4140
boolean reuse = env.getProperty("reuse", Boolean.class, false);
@@ -70,7 +69,6 @@ public Statement apply(Statement base, Description description) {
7069
}
7170
}
7271

73-
7472
@Bean
7573
public RedisContainer redisContainer(Network daprNetwork, Environment env){
7674
boolean reuse = env.getProperty("reuse", Boolean.class, false);
@@ -101,8 +99,4 @@ public DaprContainer daprContainer(Network daprNetwork, RedisContainer redisCont
10199
.dependsOn(redisContainer);
102100
}
103101

104-
105-
106-
107-
108102
}

spring-boot-examples/workflows/multi-app/worker-two/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
<plugin>
5454
<groupId>org.springframework.boot</groupId>
5555
<artifactId>spring-boot-maven-plugin</artifactId>
56+
<configuration>
57+
<finalName>worker-two</finalName>
58+
</configuration>
5659
<executions>
5760
<execution>
5861
<goals>

spring-boot-examples/workflows/multi-app/worker-two/src/test/java/io/dapr/springboot/examples/workertwo/DaprTestContainersConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public DaprContainer daprContainer(Network daprNetwork, RedisContainer redisCont
8787
redisProps.put("redisPassword", "");
8888
redisProps.put("actorStateStore", String.valueOf(true));
8989

90-
9190
return new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
9291
.withAppName("worker-two")
9392
.withNetwork(daprNetwork)

0 commit comments

Comments
 (0)