-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyWorkflow.workflow.cs
56 lines (45 loc) · 1.18 KB
/
MyWorkflow.workflow.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Temporalio.Workflows;
public record SimpleInput(String val);
public record SimpleOutput(String result);
[Workflow]
public class MyWorkflow {
private String name = "";
private String title = "";
private Boolean exit = false;
[WorkflowRun]
public async Task<String> Exec()
{
// wait for greeting info
await Workflow.WaitConditionAsync(() => name != null && title != null);
// Execute Child Workflow
String result = await Workflow.ExecuteChildWorkflowAsync((MyChildWorkflow wf) => wf.ExecChild(name,title),
new()
{
Id = Constants.CHILD_WF_ID,
});
// Wait for exit signal
await Workflow.WaitConditionAsync(() => exit != false);
return result;
}
[WorkflowSignal]
public async Task SignalNameAndTitle(String name, String title)
{
this.name = name;
this.title = title;
}
[WorkflowQuery]
public String QueryName()
{
return name;
}
[WorkflowQuery]
public String QueryTitle()
{
return title;
}
[WorkflowSignal]
public async Task Exit()
{
this.exit = true;
}
}