File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed
src/main/java/com/uber/cadence/samples/hello Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change 7
7
import com .uber .cadence .workflow .QueryMethod ;
8
8
import com .uber .cadence .workflow .Workflow ;
9
9
import com .uber .cadence .workflow .WorkflowMethod ;
10
+ import java .util .UUID ;
10
11
11
12
/**
12
13
* Hello SideEffect Cadence workflow that sets a SideEffect. The set value can be queried Requires a
@@ -19,7 +20,7 @@ public class HelloSideEffect {
19
20
/** Workflow interface has to have at least one method annotated with @WorkflowMethod. */
20
21
public interface SideEffectWorkflow {
21
22
@ WorkflowMethod (executionStartToCloseTimeoutSeconds = 10 , taskList = TASK_LIST )
22
- void set ( String value );
23
+ void start ( );
23
24
24
25
/** @return set value */
25
26
@ QueryMethod
@@ -31,18 +32,13 @@ public static class SideEffectWorkflowImpl implements SideEffectWorkflow {
31
32
private String value = "" ;
32
33
33
34
@ Override
34
- public void set (String value ) {
35
- Workflow .sideEffect (
36
- String .class ,
37
- () -> {
38
- return value ;
39
- });
40
- Workflow .sideEffect (
41
- Boolean .class ,
42
- () -> {
43
- return true ;
44
- });
45
- this .value = value ;
35
+ public void start () {
36
+ this .value =
37
+ Workflow .sideEffect (
38
+ String .class ,
39
+ () -> {
40
+ return UUID .randomUUID ().toString ();
41
+ });
46
42
}
47
43
48
44
@ Override
@@ -65,7 +61,7 @@ public static void main(String[] args) {
65
61
// Get a workflow stub using the same task list the worker uses.
66
62
SideEffectWorkflow workflow = workflowClient .newWorkflowStub (SideEffectWorkflow .class );
67
63
// Execute a workflow waiting for it to complete.
68
- workflow .set ( "test" );
64
+ workflow .start ( );
69
65
// Query and print the set value
70
66
System .out .println (workflow .get ());
71
67
System .exit (0 );
You can’t perform that action at this time.
0 commit comments