Skip to content

Commit c5658eb

Browse files
Use 1.16 rc.3 (#1488)
* chore: Use dapr release 1.16-rc.3 Signed-off-by: Javier Aliaga <[email protected]> * feat: Move field to top level request Signed-off-by: Javier Aliaga <[email protected]> * chore: Update mechanical markdown workflow timeouts Signed-off-by: Javier Aliaga <[email protected]> * chore: Run MM workflows tests in parallel Signed-off-by: Javier Aliaga <[email protected]> * fix: Fix tracing examples Signed-off-by: Javier Aliaga <[email protected]> * ci: Do not run tests during example validations We have specifics jobs that runs tests. Do not run them as part as validations Signed-off-by: Javier Aliaga <[email protected]> * ci: Improve validate job No need to run separate jobs for clean, compile and install Signed-off-by: Javier Aliaga <[email protected]> * ci: Run workflows examples sequentially Signed-off-by: Javier Aliaga <[email protected]> * ci: Add timeout to strem pubsub Signed-off-by: Javier Aliaga <[email protected]> * ci: Fix order of examples Signed-off-by: Javier Aliaga <[email protected]> * ci: Fix validation tests for sb workflows Signed-off-by: Javier Aliaga <[email protected]> * nit: Add copyright header Signed-off-by: Javier Aliaga <[email protected]> --------- Signed-off-by: Javier Aliaga <[email protected]>
1 parent 4ee6be0 commit c5658eb

File tree

29 files changed

+195
-126
lines changed

29 files changed

+195
-126
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
GOPROXY: https://proxy.golang.org
4040
JDK_VER: ${{ matrix.java }}
4141
DAPR_CLI_VER: 1.15.0
42-
DAPR_RUNTIME_VER: 1.16.0-rc.2
42+
DAPR_RUNTIME_VER: 1.16.0-rc.3
4343
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.15.0/install/install.sh
4444
DAPR_CLI_REF:
4545
DAPR_REF:

.github/workflows/validate.yml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
GOPROXY: https://proxy.golang.org
3939
JDK_VER: ${{ matrix.java }}
4040
DAPR_CLI_VER: 1.15.0
41-
DAPR_RUNTIME_VER: 1.16.0-rc.2
41+
DAPR_RUNTIME_VER: 1.16.0-rc.3
4242
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.15.0/install/install.sh
4343
DAPR_CLI_REF:
4444
DAPR_REF:
@@ -107,12 +107,26 @@ jobs:
107107
pip3 install mechanical-markdown
108108
- name: Verify scheduler is listening on port.
109109
run: sleep 30 && docker logs dapr_scheduler && nc -vz localhost 50006
110-
- name: Clean up files
111-
run: ./mvnw clean
112-
- name: Build sdk
113-
run: ./mvnw compile -q
114110
- name: Install jars
115-
run: ./mvnw install -q
111+
run: ./mvnw clean install -DskipTests -q
112+
env:
113+
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
114+
- name: Validate workflows example
115+
working-directory: ./examples
116+
run: |
117+
mm.py ./src/main/java/io/dapr/examples/workflows/README.md
118+
env:
119+
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
120+
- name: Validate Spring Boot examples
121+
working-directory: ./spring-boot-examples
122+
run: |
123+
mm.py README.md
124+
env:
125+
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
126+
- name: Validate Spring Boot Workflow examples
127+
working-directory: ./spring-boot-examples/workflows
128+
run: |
129+
mm.py README.md
116130
env:
117131
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
118132
- name: Validate Jobs example
@@ -199,27 +213,10 @@ jobs:
199213
mm.py ./src/main/java/io/dapr/examples/querystate/README.md
200214
env:
201215
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
202-
- name: Validate workflows example
203-
working-directory: ./examples
204-
run: |
205-
mm.py ./src/main/java/io/dapr/examples/workflows/README.md
206-
env:
207-
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
208216
- name: Validate streaming subscription example
209217
working-directory: ./examples
210218
run: |
211219
mm.py ./src/main/java/io/dapr/examples/pubsub/stream/README.md
212220
env:
213221
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
214-
- name: Validate Spring Boot examples
215-
working-directory: ./spring-boot-examples
216-
run: |
217-
mm.py README.md
218-
env:
219-
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
220-
- name: Validate Spring Boot Workflow examples
221-
working-directory: ./spring-boot-examples/workflows
222-
run: |
223-
mm.py README.md
224-
env:
225-
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
222+

daprdocs/content/en/java-sdk-docs/spring-boot/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public class DaprTestContainersConfig {
9595
@ServiceConnection
9696
public DaprContainer daprContainer(Network daprNetwork, PostgreSQLContainer<?> postgreSQLContainer){
9797

98-
return new DaprContainer("daprio/daprd:1.16.0-rc.2")
98+
return new DaprContainer("daprio/daprd:1.16.0-rc.3")
9999
.withAppName("producer-app")
100100
.withNetwork(daprNetwork)
101101
.withComponent(new Component("kvstore", "state.postgresql", "v1", STATE_STORE_PROPERTIES))
@@ -250,7 +250,7 @@ Finally, because Dapr PubSub requires a bidirectional connection between your ap
250250
@ServiceConnection
251251
public DaprContainer daprContainer(Network daprNetwork, PostgreSQLContainer<?> postgreSQLContainer, RabbitMQContainer rabbitMQContainer){
252252

253-
return new DaprContainer("daprio/daprd:1.16.0-rc.2")
253+
return new DaprContainer("daprio/daprd:1.16.0-rc.3")
254254
.withAppName("producer-app")
255255
.withNetwork(daprNetwork)
256256
.withComponent(new Component("kvstore", "state.postgresql", "v1", STATE_STORE_PROPERTIES))

examples/src/main/java/io/dapr/examples/pubsub/stream/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ expected_stdout_lines:
9393
- '== APP == Subscriber got: This is message #0'
9494
- '== APP == Subscriber got: This is message #1'
9595
background: true
96-
sleep: 30
96+
sleep: 15
97+
timeout_seconds: 30
9798
-->
9899

99100
```bash
@@ -111,6 +112,7 @@ expected_stdout_lines:
111112
- '== APP == Published message: This is message #1'
112113
background: true
113114
sleep: 15
115+
timeout_seconds: 30
114116
-->
115117

116118
```bash

examples/src/main/java/io/dapr/examples/tracing/InvokeClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public static void main(String[] args) throws Exception {
7575
openTelemetrySdk.getSdkTracerProvider().shutdown();
7676
Validation.validate();
7777
System.out.println("Done");
78+
System.exit(0);
7879
}
7980
}
8081
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ name: Run demo service
138138
expected_stdout_lines:
139139
background: true
140140
sleep: 20
141+
timeout_seconds: 40
141142
-->
142143

143144
```bash
@@ -225,6 +226,7 @@ name: Run proxy service
225226
expected_stdout_lines:
226227
background: true
227228
sleep: 20
229+
timeout_seconds: 40
228230
-->
229231

230232
```bash
@@ -284,6 +286,7 @@ expected_stdout_lines:
284286
- '== APP == Done'
285287
background: true
286288
sleep: 20
289+
timeout_seconds: 40
287290
-->
288291

289292
```bash

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

Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ expected_stdout_lines:
142142
- 'Message Received from input: Seattle'
143143
- 'Sending message to output: SEATTLE'
144144
- 'Workflow finished with result: TOKYO, LONDON, SEATTLE'
145+
timeout_seconds: 20
145146
background: true
146-
sleep: 60
147-
timeout_seconds: 60
148147
-->
149148
Execute the following script in order to run DemoChainWorker:
150149
```sh
151-
dapr run --app-id demoworkflowworker --resources-path ./components/workflows --dapr-grpc-port 50001 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.chain.DemoChainWorker
150+
dapr run --app-id demoworkflowworker --resources-path ./components/workflows --dapr-grpc-port 50001 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.chain.DemoChainWorker 50001
152151
```
153152

154153
Once running, the logs will start displaying the different steps: First, you can see workflow is starting:
@@ -158,9 +157,19 @@ Once running, the logs will start displaying the different steps: First, you can
158157
== APP == INFO: Durable Task worker is connecting to sidecar at 127.0.0.1:50001.
159158
```
160159

160+
<!-- END_STEP -->
161+
162+
<!-- STEP
163+
name: Execute Chaining Pattern workflow
164+
match_order: none
165+
output_match_mode: substring
166+
expected_stdout_lines:
167+
- 'completed with result: TOKYO, LONDON, SEATTLE'
168+
timeout_seconds: 20
169+
-->
161170
Then, execute the following script in order to run DemoChainClient:
162171
```sh
163-
java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.chain.DemoChainClient
172+
sleep 10 && java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.chain.DemoChainClient 50001
164173
```
165174
<!-- END_STEP -->
166175

@@ -241,7 +250,7 @@ public class CountWordsActivity implements WorkflowActivity {
241250
}
242251
```
243252
<!-- STEP
244-
name: Run Chaining Pattern workflow
253+
name: Run FanInOut Pattern workflow
245254
match_order: none
246255
output_match_mode: substring
247256
expected_stdout_lines:
@@ -251,20 +260,29 @@ expected_stdout_lines:
251260
- 'Activity returned: 17.'
252261
- 'Activity returned: 11.'
253262
- 'Workflow finished with result: 60'
263+
timeout_seconds: 20
254264
background: true
255-
sleep: 60
256-
timeout_seconds: 60
257265
-->
258266

259267
Execute the following script in order to run DemoFanInOutWorker:
260268
```sh
261-
dapr run --app-id demoworkflowworker --resources-path ./components/workflows --dapr-grpc-port 50001 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.faninout.DemoFanInOutWorker
269+
dapr run --app-id demoworkflowworker --resources-path ./components/workflows --dapr-grpc-port 50002 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.faninout.DemoFanInOutWorker 50002
262270
```
263271

272+
<!-- END_STEP -->
273+
274+
<!-- STEP
275+
name: Execute FanInOut Pattern workflow
276+
match_order: none
277+
output_match_mode: substring
278+
expected_stdout_lines:
279+
- 'completed with result: 60'
280+
timeout_seconds: 20
281+
-->
264282
Execute the following script in order to run DemoFanInOutClient:
265283

266284
```sh
267-
java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.faninout.DemoFanInOutClient
285+
sleep 10 && java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.faninout.DemoFanInOutClient 50002
268286
```
269287
<!-- END_STEP -->
270288

@@ -294,7 +312,6 @@ and the client:
294312
Started a new fan out/fan in model model workflow with instance ID: 092c1928-b5dd-4576-9468-300bf6aed986
295313
workflow instance with ID: 092c1928-b5dd-4576-9468-300bf6aed986 completed with result: 60
296314
```
297-
298315
### Continue As New Pattern
299316
`ContinueAsNew` API allows you to restart the workflow with a new input.
300317

@@ -606,8 +623,6 @@ expected_stdout_lines:
606623
- "Registered Activity: CancelCarActivity"
607624
- "Successfully built dapr workflow runtime"
608625
- "Start workflow runtime"
609-
- "Durable Task worker is connecting to sidecar at 127.0.0.1:50001."
610-
611626
- "Starting Workflow: io.dapr.examples.workflows.compensation.BookTripWorkflow"
612627
- "Starting Activity: io.dapr.examples.workflows.compensation.BookFlightActivity"
613628
- "Activity completed with result: Flight booked successfully"
@@ -625,18 +640,27 @@ expected_stdout_lines:
625640
- "Starting Activity: io.dapr.examples.workflows.compensation.CancelFlightActivity"
626641
- "Activity completed with result: Flight canceled successfully"
627642
background: true
628-
sleep: 60
629-
timeout_seconds: 60
643+
timeout_seconds: 30
630644
-->
631645

632646
Execute the following script in order to run the BookTripWorker:
633647
```sh
634-
dapr run --app-id book-trip-worker --resources-path ./components/workflows --dapr-grpc-port 50001 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.compensation.BookTripWorker
648+
dapr run --app-id book-trip-worker --resources-path ./components/workflows --dapr-grpc-port 50003 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.compensation.BookTripWorker 50003
635649
```
636650

651+
<!-- END_STEP -->
652+
653+
<!-- STEP
654+
name: Execute Compensation Pattern workflow
655+
match_order: none
656+
output_match_mode: substring
657+
expected_stdout_lines:
658+
- 'Workflow failed, compensation applied'
659+
timeout_seconds: 30
660+
-->
637661
Once running, execute the following script to run the BookTripClient:
638662
```sh
639-
java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.compensation.BookTripClient
663+
sleep 15 && java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.compensation.BookTripClient 50003
640664
```
641665
<!-- END_STEP -->
642666

@@ -656,7 +680,7 @@ Key Points:
656680

657681
### Suspend/Resume Pattern
658682

659-
Workflow instances can be suspended and resumed. This example shows how to use the suspend and resume commands.
683+
Workflow instances can be suspended and resumed. This example shows how to use the suspend and resume commands.
660684

661685
For testing the suspend and resume operations we will use the same workflow definition used by the DemoExternalEventWorkflow.
662686

@@ -669,26 +693,34 @@ match_order: none
669693
output_match_mode: substring
670694
expected_stdout_lines:
671695
- "Waiting for approval..."
672-
- "Suspending Workflow Instance"
673-
- "Workflow Instance Status: SUSPENDED"
674-
- "Let's resume the Workflow Instance before sending the external event"
675-
- "Workflow Instance Status: RUNNING"
676-
- "Now that the instance is RUNNING again, lets send the external event."
677696
- "approval granted - do the approved action"
678697
- "Starting Activity: io.dapr.examples.workflows.externalevent.ApproveActivity"
679698
- "Running approval activity..."
680699
- "approval-activity finished"
681700
background: true
682-
sleep: 60
683-
timeout_seconds: 60
701+
timeout_seconds: 30
684702
-->
685703

686704
```sh
687-
dapr run --app-id demoworkflowworker --resources-path ./components/workflows --dapr-grpc-port 50001 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.suspendresume.DemoSuspendResumeWorker
705+
dapr run --app-id demoworkflowworker --resources-path ./components/workflows --dapr-grpc-port 50004 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.suspendresume.DemoSuspendResumeWorker 50004
688706
```
689707

708+
<!-- END_STEP -->
709+
710+
<!-- STEP
711+
name: Execute Suspend/Resume workflow
712+
match_order: none
713+
output_match_mode: substring
714+
expected_stdout_lines:
715+
- "Suspending Workflow Instance"
716+
- "Workflow Instance Status: SUSPENDED"
717+
- "Let's resume the Workflow Instance before sending the external event"
718+
- "Workflow Instance Status: RUNNING"
719+
- "Now that the instance is RUNNING again, lets send the external event."
720+
timeout_seconds: 30
721+
-->
690722
```sh
691-
java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.suspendresume.DemoSuspendResumeClient
723+
sleep 15 && java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.workflows.suspendresume.DemoSuspendResumeClient 50004
692724
```
693725

694726
<!-- END_STEP -->

examples/src/main/java/io/dapr/examples/workflows/chain/DemoChainClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package io.dapr.examples.workflows.chain;
1515

16+
import io.dapr.examples.workflows.utils.PropertyUtils;
1617
import io.dapr.workflows.client.DaprWorkflowClient;
1718
import io.dapr.workflows.client.WorkflowInstanceStatus;
1819

@@ -26,7 +27,7 @@ public class DemoChainClient {
2627
* @throws InterruptedException If program has been interrupted.
2728
*/
2829
public static void main(String[] args) {
29-
try (DaprWorkflowClient client = new DaprWorkflowClient()) {
30+
try (DaprWorkflowClient client = new DaprWorkflowClient(PropertyUtils.getProperties(args))) {
3031
String instanceId = client.scheduleNewWorkflow(DemoChainWorkflow.class);
3132
System.out.printf("Started a new chaining model workflow with instance ID: %s%n", instanceId);
3233
WorkflowInstanceStatus workflowInstanceStatus =

examples/src/main/java/io/dapr/examples/workflows/chain/DemoChainWorker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package io.dapr.examples.workflows.chain;
1515

16+
import io.dapr.examples.workflows.utils.PropertyUtils;
1617
import io.dapr.workflows.runtime.WorkflowRuntime;
1718
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;
1819

@@ -25,7 +26,7 @@ public class DemoChainWorker {
2526
*/
2627
public static void main(String[] args) throws Exception {
2728
// Register the Workflow with the builder.
28-
WorkflowRuntimeBuilder builder = new WorkflowRuntimeBuilder().registerWorkflow(DemoChainWorkflow.class);
29+
WorkflowRuntimeBuilder builder = new WorkflowRuntimeBuilder(PropertyUtils.getProperties(args)).registerWorkflow(DemoChainWorkflow.class);
2930
builder.registerActivity(ToUpperCaseActivity.class);
3031

3132
// Build and then start the workflow runtime pulling and executing tasks

examples/src/main/java/io/dapr/examples/workflows/childworkflow/DemoChildWorkerflowClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package io.dapr.examples.workflows.childworkflow;
1515

16+
import io.dapr.examples.workflows.utils.PropertyUtils;
1617
import io.dapr.workflows.client.DaprWorkflowClient;
1718
import io.dapr.workflows.client.WorkflowInstanceStatus;
1819

@@ -26,7 +27,7 @@ public class DemoChildWorkerflowClient {
2627
* @throws InterruptedException If program has been interrupted.
2728
*/
2829
public static void main(String[] args) {
29-
try (DaprWorkflowClient client = new DaprWorkflowClient()) {
30+
try (DaprWorkflowClient client = new DaprWorkflowClient(PropertyUtils.getProperties(args))) {
3031
String instanceId = client.scheduleNewWorkflow(DemoWorkflow.class);
3132
System.out.printf("Started a new child-workflow model workflow with instance ID: %s%n", instanceId);
3233
WorkflowInstanceStatus workflowInstanceStatus =

0 commit comments

Comments
 (0)