forked from jwulf/camunda-cloud-test-drive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
greeting.js
27 lines (26 loc) · 830 Bytes
/
greeting.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
zbc.createWorkflowInstanceWithResult("demo-get-greeting-2", {}).then(res => {
core.info("===Outcome to Requestor===");
core.info(JSON.stringify(res, null, 2));
core.info("===Outcome to Requestor===");
setTimeout(() => zbc.close().then(() => process.exit(0)), 500);
});
module.exports = {
tasks: {
"get-greeting": (job, complete) => {
core.info("===Worker===");
core.info(`Got a job from Camunda Cloud:`);
core.info(JSON.stringify(job, null, 2));
core.info("===Worker===");
const { hour } = job.variables;
let greeting;
if (hour > 5 && hour < 12) {
greeting = "Good morning!";
} else if (hour >= 12 && hour < 20) {
greeting = "Good afternoon";
} else {
greeting = "Good night!";
}
complete.success({ greeting });
}
}
};