Skip to content

Commit 7ed4d91

Browse files
cicoylesiri-varma
andauthored
Use dapr/durabletask-java (#1336)
* microsoft durabletask-java -> dapr durabletask-java Signed-off-by: Cassandra Coyle <[email protected]> * update another ref Signed-off-by: Cassandra Coyle <[email protected]> * 1.5.2 release Signed-off-by: Cassandra Coyle <[email protected]> * fix import order Signed-off-by: Cassandra Coyle <[email protected]> * Sdk new changes Signed-off-by: siri-varma <[email protected]> * Refine workflows Signed-off-by: siri-varma <[email protected]> * add ; Signed-off-by: Cassandra Coyle <[email protected]> * rm try Signed-off-by: Cassandra Coyle <[email protected]> --------- Signed-off-by: Cassandra Coyle <[email protected]> Signed-off-by: siri-varma <[email protected]> Co-authored-by: siri-varma <[email protected]>
1 parent ecc94f5 commit 7ed4d91

34 files changed

+165
-107
lines changed

dapr-spring/dapr-spring-workflows/src/main/java/io/dapr/spring/workflows/config/DaprWorkflowsConfiguration.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ private void registerWorkflowsAndActivities(ApplicationContext applicationContex
4646
workflowRuntimeBuilder.registerActivity(activity);
4747
}
4848

49-
try (WorkflowRuntime runtime = workflowRuntimeBuilder.build()) {
50-
LOGGER.info("Starting workflow runtime ... ");
51-
runtime.start(false);
52-
}
49+
WorkflowRuntime runtime = workflowRuntimeBuilder.build();
50+
LOGGER.info("Starting workflow runtime ... ");
51+
runtime.start(false);
5352
}
5453

5554
@Override

examples/src/main/java/io/dapr/examples/unittesting/DaprWorkflowExampleTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
package io.dapr.examples.unittesting;
1515

16-
import com.microsoft.durabletask.Task;
17-
import com.microsoft.durabletask.TaskCanceledException;
16+
import io.dapr.durabletask.Task;
17+
import io.dapr.durabletask.TaskCanceledException;
1818
import io.dapr.workflows.Workflow;
1919
import io.dapr.workflows.WorkflowContext;
2020
import io.dapr.workflows.WorkflowStub;

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ public static void main(String[] args) throws Exception {
2929
builder.registerActivity(ToUpperCaseActivity.class);
3030

3131
// Build and then start the workflow runtime pulling and executing tasks
32-
try (WorkflowRuntime runtime = builder.build()) {
33-
System.out.println("Start workflow runtime");
34-
runtime.start();
35-
}
32+
WorkflowRuntime runtime = builder.build();
33+
System.out.println("Start workflow runtime");
34+
runtime.start();
3635
}
3736
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public static void main(String[] args) throws Exception {
3131
builder.registerActivity(ReverseActivity.class);
3232

3333
// Build and then start the workflow runtime pulling and executing tasks
34-
try (WorkflowRuntime runtime = builder.build()) {
35-
System.out.println("Start workflow runtime");
36-
runtime.start();
37-
}
34+
WorkflowRuntime runtime = builder.build();
35+
System.out.println("Start workflow runtime");
3836
}
3937
}

examples/src/main/java/io/dapr/examples/workflows/continueasnew/DemoContinueAsNewWorker.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import io.dapr.workflows.runtime.WorkflowRuntime;
1717
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;
1818

19+
import java.util.concurrent.ExecutorService;
20+
import java.util.concurrent.Executors;
21+
1922
public class DemoContinueAsNewWorker {
2023
/**
2124
* The main method of this app.
@@ -25,13 +28,14 @@ public class DemoContinueAsNewWorker {
2528
*/
2629
public static void main(String[] args) throws Exception {
2730
// Register the Workflow with the builder.
28-
WorkflowRuntimeBuilder builder = new WorkflowRuntimeBuilder().registerWorkflow(DemoContinueAsNewWorkflow.class);
31+
WorkflowRuntimeBuilder builder = new WorkflowRuntimeBuilder().
32+
registerWorkflow(DemoContinueAsNewWorkflow.class)
33+
.withExecutorService(Executors.newFixedThreadPool(3));
2934
builder.registerActivity(CleanUpActivity.class);
3035

3136
// Build and then start the workflow runtime pulling and executing tasks
32-
try (WorkflowRuntime runtime = builder.build()) {
33-
System.out.println("Start workflow runtime");
34-
runtime.start();
35-
}
37+
WorkflowRuntime runtime = builder.build();
38+
System.out.println("Start workflow runtime");
39+
runtime.start();
3640
}
3741
}

examples/src/main/java/io/dapr/examples/workflows/externalevent/DemoExternalEventWorker.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ public static void main(String[] args) throws Exception {
3030
builder.registerActivity(DenyActivity.class);
3131

3232
// Build and then start the workflow runtime pulling and executing tasks
33-
try (WorkflowRuntime runtime = builder.build()) {
34-
System.out.println("Start workflow runtime");
35-
runtime.start();
36-
}
33+
WorkflowRuntime runtime = builder.build();
34+
System.out.println("Start workflow runtime");
35+
runtime.start();
3736
}
3837
}

examples/src/main/java/io/dapr/examples/workflows/faninout/DemoFanInOutWorker.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ public static void main(String[] args) throws Exception {
2929
builder.registerActivity(CountWordsActivity.class);
3030

3131
// Build and then start the workflow runtime pulling and executing tasks
32-
try (WorkflowRuntime runtime = builder.build()) {
33-
System.out.println("Start workflow runtime");
34-
runtime.start();
35-
}
32+
WorkflowRuntime runtime = builder.build();
33+
System.out.println("Start workflow runtime");
34+
runtime.start(false);
3635
}
3736
}

examples/src/main/java/io/dapr/examples/workflows/faninout/DemoFanInOutWorkflow.java

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

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

16-
import com.microsoft.durabletask.Task;
16+
import io.dapr.durabletask.Task;
1717
import io.dapr.workflows.Workflow;
1818
import io.dapr.workflows.WorkflowStub;
1919

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<!--
3737
manually declare durabletask-client's jackson dependencies for workflows sdk
3838
which conflict with dapr-sdk's jackson dependencies
39-
https://github.com/microsoft/durabletask-java/blob/main/client/build.gradle#L16
39+
https://github.com/dapr/durabletask-java/blob/main/client/build.gradle#L16
4040
-->
4141
<jackson.version>2.16.1</jackson.version>
4242
<gpg.skip>true</gpg.skip>

sdk-tests/src/test/java/io/dapr/it/testcontainers/DaprWorkflowsIT.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ static void daprProperties(DynamicPropertyRegistry registry) {
9191
*/
9292
@BeforeEach
9393
public void init() {
94-
try (WorkflowRuntime runtime = workflowRuntimeBuilder.build()) {
95-
System.out.println("Start workflow runtime");
96-
runtime.start(false);
97-
}
94+
WorkflowRuntime runtime = workflowRuntimeBuilder.build();
95+
System.out.println("Start workflow runtime");
96+
runtime.start(false);
9897
}
9998

10099
@Test

0 commit comments

Comments
 (0)