File tree Expand file tree Collapse file tree 5 files changed +50
-1
lines changed
src/main/java/com/uber/cadence/samples/spring Expand file tree Collapse file tree 5 files changed +50
-1
lines changed Original file line number Diff line number Diff line change 22
22
23
23
import com .uber .cadence .client .WorkflowClient ;
24
24
import com .uber .cadence .client .WorkflowClientOptions ;
25
+ import com .uber .cadence .samples .spring .workflows .impl .ChildWorkflowImpl ;
25
26
import com .uber .cadence .samples .spring .workflows .impl .HelloWorldWorkflowImpl ;
27
+ import com .uber .cadence .samples .spring .workflows .impl .ParentWorkflowImpl ;
26
28
import com .uber .cadence .samples .spring .workflows .impl .SignalWorkflowImpl ;
27
29
import com .uber .cadence .serviceclient .ClientOptions ;
28
30
import com .uber .cadence .serviceclient .WorkflowServiceTChannel ;
@@ -53,7 +55,10 @@ public void startWorker(ApplicationStartedEvent event) {
53
55
Worker worker = factory .newWorker (TASK_LIST );
54
56
55
57
worker .registerWorkflowImplementationTypes (
56
- HelloWorldWorkflowImpl .class , SignalWorkflowImpl .class );
58
+ HelloWorldWorkflowImpl .class ,
59
+ SignalWorkflowImpl .class ,
60
+ ParentWorkflowImpl .class ,
61
+ ChildWorkflowImpl .class );
57
62
factory .start ();
58
63
}
59
64
}
Original file line number Diff line number Diff line change
1
+ package com .uber .cadence .samples .spring .workflows ;
2
+
3
+ import com .uber .cadence .workflow .WorkflowMethod ;
4
+
5
+ public interface ChildWorkflow {
6
+ @ WorkflowMethod
7
+ String greetInChild (String msg );
8
+ }
Original file line number Diff line number Diff line change
1
+ package com .uber .cadence .samples .spring .workflows ;
2
+
3
+ import static com .uber .cadence .samples .spring .common .Constant .TASK_LIST ;
4
+
5
+ import com .uber .cadence .samples .spring .models .SampleMessage ;
6
+ import com .uber .cadence .workflow .WorkflowMethod ;
7
+
8
+ public interface ParentWorkflow {
9
+ @ WorkflowMethod (executionStartToCloseTimeoutSeconds = 10 , taskList = TASK_LIST )
10
+ String getGreetingInParent (SampleMessage sampleMessage );
11
+ }
Original file line number Diff line number Diff line change
1
+ package com .uber .cadence .samples .spring .workflows .impl ;
2
+
3
+ import com .uber .cadence .samples .spring .workflows .ChildWorkflow ;
4
+
5
+ public class ChildWorkflowImpl implements ChildWorkflow {
6
+ @ Override
7
+ public String greetInChild (String msg ) {
8
+ return "Hello, " + msg + "!" ;
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ package com .uber .cadence .samples .spring .workflows .impl ;
2
+
3
+ import com .uber .cadence .samples .spring .models .SampleMessage ;
4
+ import com .uber .cadence .samples .spring .workflows .ChildWorkflow ;
5
+ import com .uber .cadence .samples .spring .workflows .ParentWorkflow ;
6
+ import com .uber .cadence .workflow .Workflow ;
7
+
8
+ public class ParentWorkflowImpl implements ParentWorkflow {
9
+ @ Override
10
+ public String getGreetingInParent (SampleMessage sampleMessage ) {
11
+ // Workflows are stateful. So a new stub must be created for each new child.
12
+ ChildWorkflow childWorkflow = Workflow .newChildWorkflowStub (ChildWorkflow .class );
13
+ return childWorkflow .greetInChild (sampleMessage .GetMessage ());
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments