From 5d014931818c7def792e7a5737963441ac44fd6a Mon Sep 17 00:00:00 2001 From: Cassie Coyle Date: Thu, 15 May 2025 19:03:57 -0500 Subject: [PATCH] Fix the issue with retries not happening correctly for Activities and Workflows (#1343) (#1374) * Add coverage for some properties (#1297) * Make the DAPR version being used consistent across all tests (#1299) * Separate Dapr constants from IT container constants (#1315) * Use Java Bean for connection details and add more tests (#1317) * Use Java Bean for connection details and add more tests * Simplify mock setup * Adding even more tests for test coverage --------- * Update CONTRIBUTING.md * Bump codecov/codecov-action from 5.4.0 to 5.4.2 (#1318) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.4.0 to 5.4.2. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v5.4.0...v5.4.2) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: 5.4.2 dependency-type: direct:production update-type: version-update:semver-patch ... * Fix URL building logic (#1320) * Fix URL building logic * Add test for query params * Fix the assertion in the test * Adjust the tests * Remove uneeded changes from IT test * Revert some unintended changes * Simplify the testing a little bit * Adjust the test to use ServerRequest * Test removing things from method invoke controller * Add query param encoding test * Revert some unintended changes * Some tiny styles --------- * Generate updated javadocs for 1.14.1 * Add Conversation AI to Java SDK (#1235) * Conversation first commit * Add unit tests * change ai to conv * Move to single module * Remove module * Add Integration tests * Update sdk-tests/src/test/java/io/dapr/it/testcontainers/DaprConversationIT.java * Fix things * Address comments * Import tag * Address comments * Make common config * Address comments * fix constant * fix constant * fix constant * fix s * Fix things * Fix things * Fix things * Make common config * Update README.md * Update README.md --------- * Add docs for usage of Jobs SDK (#1323) * Add doc for jobs * Add docs for Jobs * Apply suggestions from code review --------- * Use dapr/durabletask-java (#1336) * microsoft durabletask-java -> dapr durabletask-java * update another ref * 1.5.2 release * fix import order * Sdk new changes * Refine workflows * add ; * rm try --------- * Update master version to 1.16.0-SNAPSHOT * Fix NPE * Fix NPE * Fix NPE * Fix NPE * Fix NPE * Fix NPE * Fix things * Renaming and exposing connection details (#1341) * [Master] Fix Vulnerabilities (#1354) * update okio * rm unused dep --------- * Feat Add TLS & mTLS support for gRPC with root CA and insecure mode (#1361) * feat: Support for GRPC ssl * add tests * fix CI * add back else if * channel cleanup * add root ca support * checkstyles * add insecure * fix checkstyles * use InsecureTrustManagerFactory * fix test --------- * Address comments * Fix things * Fix things --------- Signed-off-by: sirivarma Signed-off-by: Artur Ciocanu Signed-off-by: Siri Varma Vegiraju Signed-off-by: dependabot[bot] Signed-off-by: Dapr Bot Signed-off-by: Siri Varma Vegiraju Signed-off-by: siri-varma Signed-off-by: Cassandra Coyle Signed-off-by: Javier Aliaga Co-authored-by: Siri Varma Vegiraju Co-authored-by: Matheus Cruz <56329339+mcruzdev@users.noreply.github.com> Co-authored-by: artur-ciocanu Co-authored-by: Artur Ciocanu Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dapr Bot <56698301+dapr-bot@users.noreply.github.com> Co-authored-by: Dapr Bot Co-authored-by: Javier Aliaga Signed-off-by: siri-varma --- .../childworkflow/DemoChildWorkflow.java | 13 ++++- .../DemoChildWorkflowWorker.java | 1 + sdk-workflows/pom.xml | 2 +- .../workflows/WorkflowTaskRetryPolicy.java | 5 +- .../runtime/DefaultWorkflowContext.java | 4 +- .../workflows/DefaultWorkflowContextTest.java | 49 +++++++++++++++++++ 6 files changed, 69 insertions(+), 5 deletions(-) diff --git a/examples/src/main/java/io/dapr/examples/workflows/childworkflow/DemoChildWorkflow.java b/examples/src/main/java/io/dapr/examples/workflows/childworkflow/DemoChildWorkflow.java index c9a9af455..4c1ac8ddb 100644 --- a/examples/src/main/java/io/dapr/examples/workflows/childworkflow/DemoChildWorkflow.java +++ b/examples/src/main/java/io/dapr/examples/workflows/childworkflow/DemoChildWorkflow.java @@ -15,6 +15,10 @@ package io.dapr.examples.workflows.childworkflow; import io.dapr.workflows.Workflow; import io.dapr.workflows.WorkflowStub; +import io.dapr.workflows.WorkflowTaskOptions; +import io.dapr.workflows.WorkflowTaskRetryPolicy; + +import java.time.Duration; public class DemoChildWorkflow implements Workflow { @Override @@ -22,11 +26,18 @@ public class DemoChildWorkflow implements Workflow { return ctx -> { ctx.getLogger().info("Starting ChildWorkflow: " + ctx.getName()); + WorkflowTaskRetryPolicy policy = WorkflowTaskRetryPolicy.newBuilder() + .setFirstRetryInterval(Duration.ofSeconds(1)) + .setMaxNumberOfAttempts(10) + .build(); + + WorkflowTaskOptions options = new WorkflowTaskOptions(policy); + var childWorkflowInput = ctx.getInput(String.class); ctx.getLogger().info("ChildWorkflow received input: " + childWorkflowInput); ctx.getLogger().info("ChildWorkflow is calling Activity: " + ReverseActivity.class.getName()); - String result = ctx.callActivity(ReverseActivity.class.getName(), childWorkflowInput, String.class).await(); + String result = ctx.callActivity(ReverseActivity.class.getName(), childWorkflowInput, options, String.class).await(); ctx.getLogger().info("ChildWorkflow finished with: " + result); ctx.complete(result); diff --git a/examples/src/main/java/io/dapr/examples/workflows/childworkflow/DemoChildWorkflowWorker.java b/examples/src/main/java/io/dapr/examples/workflows/childworkflow/DemoChildWorkflowWorker.java index 0e692551e..dce40e97e 100644 --- a/examples/src/main/java/io/dapr/examples/workflows/childworkflow/DemoChildWorkflowWorker.java +++ b/examples/src/main/java/io/dapr/examples/workflows/childworkflow/DemoChildWorkflowWorker.java @@ -32,6 +32,7 @@ public class DemoChildWorkflowWorker { // Build and then start the workflow runtime pulling and executing tasks WorkflowRuntime runtime = builder.build(); + runtime.start(); System.out.println("Start workflow runtime"); } } diff --git a/sdk-workflows/pom.xml b/sdk-workflows/pom.xml index 6d6ef0d12..26c0c241d 100644 --- a/sdk-workflows/pom.xml +++ b/sdk-workflows/pom.xml @@ -47,7 +47,7 @@ io.dapr durabletask-client - 1.5.2 + 1.5.3