-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy path05-outcomes.js
39 lines (34 loc) · 1.08 KB
/
05-outcomes.js
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
const workflow_es = require("workflow-es");
const steps = require("./05-outcomes.steps");
class MyDataClass {
}
class OutcomeSample_Workflow {
constructor() {
this.id = "outcome-sample";
this.version = 1;
}
build(builder) {
builder
.startWith(steps.SelectOutcome)
.name("Determine Future")
.input((step, data) => step.myValue = data.myValue)
.when(data => 0)
.then(steps.TaskA)
.then(steps.TaskB)
.end("Determine Future")
.when(data => 1)
.then(steps.TaskC)
.then(steps.TaskD)
.end("Determine Future");
}
}
async function main() {
var config = workflow_es.configureWorkflow();
//config.useLogger(new workflow_es.ConsoleLogger());
var host = config.getHost();
host.registerWorkflow(OutcomeSample_Workflow);
await host.start();
let id = await host.startWorkflow("outcome-sample", 1, { myValue: 7 });
console.log("Started workflow: " + id);
}
main();