-
Notifications
You must be signed in to change notification settings - Fork 13
/
worker.3.ts
46 lines (37 loc) · 1.39 KB
/
worker.3.ts
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
/*!
* Copyright (c) 2019 Ville de Montreal. All rights reserved.
* Licensed under the MIT license.
* See LICENSE file in the project root for full license information.
*/
// tslint:disable: no-floating-promises
import { IoC, Worker } from 'workit-core';
import { IWorkflowClient } from 'workit-types';
import { SERVICE_IDENTIFIER as CORE_IDENTIFIER } from '../src/config/constants/identifiers';
import { TAG } from '../src/config/constants/tag';
import '../src/config/ioc';
import { HelloWorldTask } from './tasks/helloWorldTask';
(async () => {
enum LOCAL_IDENTIFIER {
activity1 = 'activity_1',
activity2 = 'activity_2',
activity3 = 'activity_3'
}
IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity1);
IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity2);
IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity3);
const worker = IoC.get<Worker>(CORE_IDENTIFIER.worker, TAG.camundaBpm);
const cm = IoC.get<IWorkflowClient>(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);
const path = `${ process.cwd() }/sample/BPMN_P_DEMO.bpmn`;
await cm.deployWorkflow(path);
for (let index = 0; index < 1; index++) {
await cm.createWorkflowInstance({
bpmnProcessId: "BPMN_P_DEMO",
variables: {
amount: 1000,
hello: "world"
}
});
}
worker.start();
worker.run();
})();