Skip to content

Commit a269f24

Browse files
authored
Added WorkflowClient.execute (#122)
* Added Retryer.retryAsync * Introduced IWorkflowService and added getResultAsync * Added WorkflowClient.execute which returns CompletableFuture with workflow result. * Added WorkflowClient.execute and its unit test
1 parent d12c080 commit a269f24

35 files changed

+1770
-403
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ license {
5252
}
5353

5454
compileJava {
55+
dependsOn 'googleJavaFormat'
5556
options.encoding = 'UTF-8'
5657
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-XepExcludedPaths:" +
5758
".*/generated-sources/.*"
@@ -62,7 +63,6 @@ license {
6263
exclude '**/com/uber/cadence/*.java'
6364
}
6465

65-
6666
compileTestJava {
6767
options.encoding = 'UTF-8'
6868
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-XepExcludedPaths:" +

src/main/java/com/uber/cadence/activity/Activity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
package com.uber.cadence.activity;
1919

20-
import com.uber.cadence.WorkflowService;
2120
import com.uber.cadence.internal.sync.ActivityInternal;
2221
import com.uber.cadence.internal.sync.WorkflowInternal;
22+
import com.uber.cadence.serviceclient.IWorkflowService;
2323
import com.uber.cadence.workflow.ActivityException;
2424
import com.uber.cadence.workflow.ActivityTimeoutException;
2525
import java.util.concurrent.CancellationException;
@@ -76,7 +76,7 @@ public static void heartbeat(Object details) throws CancellationException {
7676
* operations like sending signal to its parent workflow. @TODO getWorkflowClient method to
7777
* hide the service.
7878
*/
79-
public static WorkflowService.Iface getService() {
79+
public static IWorkflowService getService() {
8080
return ActivityInternal.getService();
8181
}
8282

src/main/java/com/uber/cadence/client/UntypedWorkflowStub.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.uber.cadence.client;
1919

2020
import com.uber.cadence.WorkflowExecution;
21+
import java.util.concurrent.CompletableFuture;
2122
import java.util.concurrent.TimeUnit;
2223
import java.util.concurrent.TimeoutException;
2324

@@ -27,6 +28,8 @@ public interface UntypedWorkflowStub {
2728

2829
WorkflowExecution start(Object... args);
2930

31+
String getWorkflowType();
32+
3033
WorkflowExecution getExecution();
3134

3235
/**
@@ -39,6 +42,8 @@ public interface UntypedWorkflowStub {
3942
*/
4043
<R> R getResult(Class<R> returnType);
4144

45+
<R> CompletableFuture<R> getResultAsync(Class<R> returnType);
46+
4247
/**
4348
* Returns workflow result potentially waiting for workflow to complete. Behind the scene this
4449
* call performs long poll on Cadence service waiting for workflow completion notification.
@@ -52,6 +57,8 @@ public interface UntypedWorkflowStub {
5257
*/
5358
<R> R getResult(long timeout, TimeUnit unit, Class<R> returnType) throws TimeoutException;
5459

60+
<R> CompletableFuture<R> getResultAsync(long timeout, TimeUnit unit, Class<R> returnType);
61+
5562
<R> R query(String queryType, Class<R> returnType, Object... args);
5663

5764
/** Request cancellation. */

0 commit comments

Comments
 (0)