-
Notifications
You must be signed in to change notification settings - Fork 50
/
sayHello.js
41 lines (31 loc) · 1.23 KB
/
sayHello.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
40
41
const df = require("durable-functions");
const helloActivityName = "sayHello";
df.app.orchestration("helloSequence", function* (context) {
context.log("Starting chain sample");
const output = [];
output.push(yield context.df.callActivity(helloActivityName, "Tokyo"));
output.push(yield context.df.callActivity(helloActivityName, "Seattle"));
output.push(yield context.df.callActivity(helloActivityName, "Cairo"));
return output;
});
df.app.orchestration("sayHelloWithActivity", function* (context) {
const input = context.df.getInput();
const output = yield context.df.callActivity(helloActivityName, input);
return output;
});
df.app.orchestration("sayHelloWithCustomStatus", function* (context) {
const input = context.df.getInput();
const output = yield context.df.callActivity(helloActivityName, input);
context.df.setCustomStatus(output);
return output;
});
df.app.orchestration("sayHelloWithSubOrchestrator", function* (context) {
const input = context.df.getInput();
const output = yield context.df.callSubOrchestrator("sayHelloWithActivity", input);
return output;
});
df.app.activity(helloActivityName, {
handler: function (input) {
return `Hello ${input}`;
},
});